Part Number Hot Search : 
TSA5511 CMR200T MUR3040 L132XY UZ140 6S9045MB T7101 10050LVR
Product Description
Full Text Search
 

To Download TMPM372FWUG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  32-bit risc microcontroller tx03 series TMPM372FWUG semiconduct or & storage products company

revision history date rev description 2011/8/1 1.0 first release 2013/4/15 2.0 contents revised

TMPM372FWUG *************************************************************************************************************** arm, arm powered, amba, adk, arm9tdmi, tdmi, primecell, realview, thumb, cortex, coresight, arm9, arm926ej-s, embedded trace macrocell, etm, ahb, apb, and keil are registered trademarks or trademarks of arm limited in the eu and other countries. **************************************************************************************************************** ?
y TMPM372FWUG
page 1-1 TMPM372FWUG 2013/4/15 TMPM372FWUG TMPM372FWUG is a 32-bit risc microprocessor series with an arm cortex ? -m3 microprocessor core. features of the TMPM372FWUG are as follows: 1.1 features 1. arm cortex-m3 microprocessor core a. improved code efficiency has been realized through the use of thumb ? -2 instruction. ? new 16-bit thumb instructions for improved program flow ? new 32-bit thumb instructions for improved performance ? new thumb mixed 16-/32-bit instruction set can produce faster, more efficient code. b. both high performance and low power consumption have been achieved. [high performance] ? 32-bit multiplication (32 32 = 32bit) can be executed with one clock. ? division takes between 2 and 12 cycles depending on dividend and devisor [low power consumption] ? optimized design using a low power consumption library ? standby function that stops the operation of the micro controller core c. high-speed interrupt response suitable for real-time control ? an interruptible long instruction. ? stack push automatically handled by hardware. 2. on chip program memory and data memory ? on-chip ram : 6kbyte ? on-chip flashrom : 128kbyte 3. 16-bit timer (tmrb) : 8 channels ? 16-bit interval timer mode ? 16-bit event counter mode ? input capture function ? external trigger ppg output 4. watchdog timer (wdt) : 1 channel watchdog timer (wdt) generates a reset or a non-maskable interrupt (nmi). product name rom (flash) ram package TMPM372FWUG 128 kbyte 6 kbyte p-lqfp64-1010-0.50e
page 1-2 1.1 features TMPM372FWUG 2013/4/15 5. power_on reset function (por) 6. voltage detect function (vltd) 7. oscillation frequency detect function (ofd) 8. vector engine (ve) : 1unit ? calculation circuit for motor control 9. programmable motor driver (pmd) : 1channels ? 3phase complementary pwm generator ? synchronous ad convert start trigger generator ? emergency protective function (emg ) 10. encoder input circuit (enc) : 1channels ? correspond to incremental encoder (ab / abz) ? rotation direction detection ? counter for absolute position detection ? comparator for position detection ? noise filter ? 3 phase sensor input 11. general-purpose serial interface(sio/uart) : 4channels either uart mode or synchronous mode can be selected (4byte fifo equipped) 12. 12 bit ad converter (adc) : 1units ( analog input : 11channel ) ? start by the internal trigger : tmrb interrupt / pmd trigger ? constant conversion mode ? ad monitoring 2ch ? conversion speed 2 sec (@adc conversion clock = 40 mhz) 13. input/ output ports (port) : 53 pins i/o pin : 53 pins 14. interrupt source ? internal 49 factors : the order of precedence can be set over 7 levels . (except the watc hdog timer inter- rupt) ? external 10 factors : the order of precedence can be set over 7 levels. 15. standby mode standby modes : idle, stop 16. clock generator (cg) ? on-chip pll (8 times) ? clock gear function : the high-speed clock can be divided into 1/1, 1/2, 1/4, 1/8 or 1/16.
page 1-3 TMPM372FWUG 2013/4/15 17. endian little endian 18. internal high-speed oscillation circuit 19. maximum operating frequency : 80 mhz 20. operating voltage range 4.5 v to 5.5 v ( with on-chip regulator ) 21. temperature range ? ?40 c to 85 c (except during flash writing / 1 to 80 mhz) ? ?40 c to 105 c (except during flash writing / 1 to 32 mhz) ?0 c to 70 c (during flash writing / erasing) 22. package ? p-lqfp64-1010-0.50e (10 mm 10 mm, 0.5 mm pitch)
page 1-4 1.2 block diagram TMPM372FWUG 2013/4/15 1.2 block diagram figure 1-1 tmpm372f wug block diagram i-code ahb-bus-matrix (80mhz) d-code system cortex-m3 cpu debug nvic bus bridge i/f nano flash i/f ram i/f boot rom regulator 3.3v 1.5v 5v cg pll wdt ofd on_chip oscillator por/vlvd sio tmrb port a - m ve pmd adc enc ve !a rom io-bus oscillator internal high-speed oscillator
page 1-5 TMPM372FWUG 2013/4/15 1.3 pin layout (top view) the pin layout of TMPM372FWUG is a figure below. figure 1-2 pin layout (lqfp64)                 2'6$176 2'6$176 2(6$176 2('0%<4:& 2('0%$6:& 2('0%#5%.-%65 2'6$+0+06 2'5%.-%65 2'4:& 2'6:& 2$6/559&+1 2$6%-59%.- 2$6&1598 2$6&+ 2$6456 2$64#%'&#6#                 2,#+0$ 2,#+0$ 2,#+0$ 2+#+0$ 4'5'6 8176 48&& /1&' 8176 2/: &855 2/: &8&& 2#+066$+0 2#6$176 2#+066$+0 #+0$2, #+0$2, #+0$2, +06%#+0$2, +06&#+0$2, +06'#+0$2- +06(#+0$2- 84'(.$#855$ 84'(*$#8&&$ +066$1762' +066$+02' 4:&6$+02# 6:&6$1762# 5%.-%652# +066$+02# 6$1762#                 5%.-%652& 6:&2& 4:&2& 712) :12) 812) ;12) 912) <12) '/)2) 1882) &855 &8&& $1166$+02( 64#%'%.-2$ 64#%'&#6#2$                 TMPM372FWUG
page 1-6 1.4 pin names and functions TMPM372FWUG 2013/4/15 1.4 pin names and functions table 1-1 sorts the input and output pins of the tmpm372f wug by pin or port. each table includes alternate pin names and functions for multi-function pins. 1.4.1 sorted by port table 1-1 pin names and functions sorted by port (1/4) port type pin no. pin name input / output function port a function 33 pa0 tb0in int3 i/o i i i/o port inputting the timer b capture trigger external interrupt pin port a function 34 pa1 tb0out i/o o i/o port timer b output port a function 35 pa2 tb1in int4 i/o i i i/o port inputting the timer b capture trigger external interrupt pin port a function 64 pa3 tb1out i/o o i/o port timer b output port a function 62 pa4 sclk1 cts1 i/o i/o i i/o port serial clock input/ output handshake input pin port a function 61 pa5 txd1 tb6out i/o o o i/o port sending serial data timer b output port a function 60 pa6 rxd1 tb6in i/o i i i/o port receiving serial data inputting the timer b capture trigger port a function 63 pa7 tb4in int8 i/o i i i/o port inputting the timer b capture trigger external interrupt pin port b function/ debug 15 pb0 traceclk i/o o i/o port debug pin port b function/ debug 16 pb1 tracedata0 i/o o i/o port debug pin port b function/ debug 17 pb2 tracedata1 i/o o i/o port debug pin port b function/ debug 22 pb3 tms/swdio i/o i/o i/o port debug pin port b function/ debug 21 pb4 tck/swclk i/o i i/o port debug pin port b function/ debug 20 pb5 tdo/swv i/o o i/o port debug pin port b function/ debug 19 pb6 tdi i/o i i/o port debug pin port b function/ debug 18 pb7 trst i/o i i/o port debug pin port d function 1 pd4 sclk2 cts2 i/o i/o i i/o port serial clock input/ output handshake input pin
page 1-7 TMPM372FWUG 2013/4/15 port d function 2 pd5 txd2 i/o o i/o port sending serial data port d function 3 pd6 rxd2 i/o i i/o port receiving serial data port e function 23 pe0 txd0 i/o o i/o port sending serial data port e function 24 pe1 rxd0 i/o i i/o port receiving serial data port e function 25 pe2 sclk0 cts0 i/o i/o i i/o port serial clock input/ output handshake input pin port e function 32 pe3 tb4out i/o o i/o port timer b output port e function 26 pe4 tb2in int5 i/o i i i/o port inputting the timer b capture trigger external interrupt pin port e function 31 pe5 tb2out i/o o i/o port timer b output port e function 59 pe6 tb3in int6 i/o i i i/o port inputting the timer b capture trigger external interrupt pin porte function 58 pe7 tb3out int7 i/o o i i/o port timer b output external interrupt pin port f function/ control 14 pf0 tb7in boot i/o i i i/o port inputting the timer b capture trigger boot mode pin. (note) this pin goes into single boot mode by sampling "low" at the rise of a reset signal. port f function 30 pf1 tb7out i/o o i/o port timer b output port f function 27 pf2 enca1 sclk3 cts3 i/o i i/o i i/o port encoder input serial clock input/ output handshake input pin port f function 28 pf3 encb1 txd3 i/o i o i/o port encoder input sending serial data port f function 29 pf4 encz1 rxd3 i/o i i i/o port encoder input receiving serial data port g function 4 pg0 uo1 i/o o i/o port u-phase output pin port g function 5 pg1 xo1 i/o o i/o port x-phase output pin port g function 6 pg2 vo1 i/o o i/o port v-phase output pin port g function 7 pg3 yo1 i/o o i/o port y-phase output pin table 1-1 pin names and functions sorted by port (2/4) port type pin no. pin name input / output function
page 1-8 1.4 pin names and functions TMPM372FWUG 2013/4/15 port g function 8 pg4 wo1 i/o o i/o port w-phase output pin port g function 9 pg5 zo1 i/o o i/o port z-phase output pin port g function 10 pg6 emg1 i/o i i/o port emergency status detection input port g function 11 pg7 ovv1 i/o i i/o port overvoltage detection input port i function 45 pi3 ainb2 i/o i i/o port analog input port j function 46 pj0 ainb3 i/o i i/o port analog input port j function 47 pj1 ainb4 i/o i i/o port analog input port j function 48 pj2 ainb5 i/o i i/o port analog input port j function 49 pj3 ainb6 i/o i i/o port analog input port j function 50 pj4 ainb7 i/o i i/o port analog input port j function 51 pj5 ainb8 i/o i i/o port analog input port j function 52 pj6 intc ainb9 i/o i i i/o port external interrupt pin analog input port j function 53 pj7 intd ainb10 i/o i i i/o port external interrupt pin analog input port k function 54 pk0 inte ainb11 i/o i i i/o port external interrupt pin analog input port k function 55 pk1 intf ainb12 i/o i i i/o port external interrupt pin analog input port m function / clock 37 pm0 x1 i/o i i/o port co nnected to a high-speed oscillator port m function / clock 39 pm1 x2 i/o o i/o port connected to a high-speed oscillator - control 41 mode i mode pin (note) mode pin must be connected to gnd. -function44 reset i reset input pin (note) with a pull-up and a noise filter (about 30ns (typical value)) -p s1 2d v s s ? gnd pin -p s3 8d v s s ? gnd pin -p s1 3d v d d 5 ? power supply pin -p s3 6d v d d 5 ? power supply pin table 1-1 pin names and functions sorted by port (3/4) port type pin no. pin name input / output function
page 1-9 TMPM372FWUG 2013/4/15 note 1: avss must be connected to gnd even if the ad converter is not used. note 2: must be connected to power suppl y even if ad converter is not used. - ps 42 rvdd5 ? power supply pin -p s4 0v o u t 1 5 ? power supply pin -p s4 3v o u t 3 ? power supply pin -p s5 6 avssb vreflb ? ad converter: gnd pin (note 1) supplying the ad converter with a reference power supply. -p s5 7 avdd5b vrefhb ? supplying the ad converter with a power supply. (note2) supplying the ad converter with a reference power supply. table 1-1 pin names and functions sorted by port (4/4) port type pin no. pin name input / output function
page 1-10 1.5 pin numbers and power supply pins TMPM372FWUG 2013/4/15 1.5 pin numbers and power supply pins note: vout15 and vout3 must be connected with the same value of capacitors. table 1-2 pin numbers and power supplies power supply voltage range pin no. pin name dvdd5 4.5 to 5.5v 13 , 36, pa,pb,pc,pd,pe,pf,pg,pl,pm pn, reset ,mode avdd5b 57 pj rvdd5 42 ? vout15 1.35 to 1.65v 40 vout15 must be connected to dvss through 3.3 to 4.7 f capacitor for supply power to internal circuit. vout3 2.7 to 3.6v 43 vout3 must be connected to dvss through 3.3 to 4.7 f capacitor for supply power to internal circuit.
page 2-1 TMPM372FWUG 2013/4/15 2. processor core the tx03 series has a high-performance 32-bit processor core (the arm cortex-m3 processor core). for infor- mation on the operations of this processor core, please re fer to the "cortex-m3 technical reference manual" issued by arm limited.this chapter describes the functions unique to the tx03 series that are not explained in that docu- ment. 2.1 information on the processor core the following table shows the revision of the processor core in the TMPM372FWUG. refer to the detailed information about the cpu core an d architecture, refer to the arm manual "cortex-m series processors" in th e following url: http://infocenter.arm.com/help/index.jsp 2.2 configurable options the cortex-m3 core has optional blocks. the optional blocks of the revision r2p0 are etm ? and mpu. the fol- lowing tables shows the configurable options in the TMPM372FWUG. product name core revision TMPM372FWUG r2p0 configurable options implementation fpb two literal comparators six instruction comparators dwt four comparators itm implementable mpu not implementable etm implementable ahb-ap implementable ahb trace macrocell interface implementable tpiu implementable wic not implementable
page 2-2 2. processor core 2.3 exceptions/ interruptions TMPM372FWUG 2013/4/15 2.3 exceptions/ interruptions exceptions and interruptions are described in the following section. 2.3.1 number of interrupt inputs the number of interrupt inputs can optionally be defined from 1 to 240 in the cortex-m3 core. TMPM372FWUG has 59 interrupt inputs. the number of interrupt inputs is reflected in bit of nvic register. in this product, if read bit, 0x00 is read out. 2.3.2 number of priori ty level interrupt bits the cortex-m3 core can optionally configure the number of priority level interrupt bits from 3 bits to 8 bits. TMPM372FWUG has 3 priority level interrupt bits. the nu mber of priority level interrupt bits is used for assigning a priority level in the interrupt priority registers and system handler priority registers. 2.3.3 systick the cortex-m3 core has a systick timer which can generate systick exception. for the detail of systick exception, refer to the sec tion of "systick" in the exception and the register of systick in the nvic register. 2.3.4 sysresetreq the cortex-m3 core outputs sysresetreq signal when bit of application interrupt and reset control register are set. TMPM372FWUG provides the same operation when sysresetreq signal are output. 2.3.5 lockup when irreparable exception generates, the cortex-m3 core out puts lockup signal to show a serious error included in software. TMPM372FWUG does not use this signal. to return from lockup status, it is necessary to use non- maskable interruput (nmi) or reset. 2.3.6 auxiliary fault status register the cortex-m3 core provides auxiliary fault status registers to supply additional system fault information to software. however, TMPM372FWUG is not defined this function. if auxiliary fault status register is read, always "0x0000_0000" is read out.
page 2-3 TMPM372FWUG 2013/4/15 2.4 events the cortex-m3 core has event output signals and event input signals. an event output signal is output by sev instruction execution. if an event is input, the core returns from low-power consumption mode caused by wfe instruction. TMPM372FWUG does not use event output signals and even t input signals. please do not use sev instruction and wfe instruction. 2.5 power management the cortex-m3 core provides power management syst em which uses sleeping signal and sleepdeep signal. sleepdeep signals are output when bit of system control register is set. these signals are output in the following circumstances: -wait-for-interrupt (wfi) instruction execution -wait-for-event (wfe) instruction execution -the timing when interrupt-service-routine (isr) exit in case that bit of system control regis- ter is set. TMPM372FWUG does not use sleepdeep signal so that bit must not be set. and also event signal is not used so that please do not use wfe instruction. for detail of power management, refer to the chapter "clock/mode control." 2.6 exclusive access in cortex-m3 core, the dcode bus system supports exclusive access. however TMPM372FWUG does not use this function.
page 2-4 2. processor core 2.6 exclusive access TMPM372FWUG 2013/4/15
page 3-1 mpm372fwug 2013/4/15 3. memory map 3.1 memory map the memory maps for mpm372fwug are based on the arm cortex-m3 processor core memory map. the inter- nal rom, internal ram and special function register s (sfr) of mpm372fwug are mapped to the code, sram and peripheral regions of the cortex-m3 respectively. the sp ecial function register (sfr) means the control registers of all input/output ports and peripheral functions. the sram and sfr areas are all included in the bit-band region. the cpu register area is the processo r core?s internal register region. for more information on each region, see th e "cortex-m3 technical reference manual". note that access to regions indicated as "fault" causes a memory fault if memo ry faults are enabled, or causes a hard fault if memory faults are disabled. also, do not access the ve ndor-specific region. 3.1.1 mpm372fwug memory map figure 3-1 shows the memory map of the mpm372fwug. figure 3-1 memory map sfr +pvgtpcnram (6k) internal rom (128k) za z((a(((( za za za za vendor-specific cpu register region fault fault fault z'a z'(a(((( z'a z((((a(((( sfr fault za z((a( z((a'((( za(((( za
page 3-2 3. memory map 3.2 details of sfr area mpm372fwug 2013/4/15 3.2 details of sfr area table 3-1 shows the de tails of the sfr area. do not access a reserved area in table 3-1. see the chaper of each peripheral function for datails. table 3-1 details of sfr start address end address peripheral 0x4000_0000 0x4000_033f port 0x4000_0340 0x4000_ffff reserved 0x4001_0000 0x4001_01ff tmrb 0x4001_0200 0x4001_04ff reserved 0x4001_0500 0x4001_053f enc 0x4001_0540 0x4002_007f reserved 0x4002_0080 0x4002_017f sio/uart 0x4002_0180 0x4003_01f reserved 0x4003_0200 0x4003_02ff adc 0x4003_0300 0x4003_ffff reserved 0x4004_0000 0x4004_003f wdt 0x4004_0040 0x4004_01ff reserved 0x4004_0200 0x4004_023f cg 0x4004_0240 0x4004_02ff reserved 0x4004_0300 0x4004_030f trm 0x4004_0310 0x4004_07ff reserved 0x4004_0800 0x4004_083f ofd 0x4004_0840 0x4004_08ff reserved 0x4004_0900 0x4004_093f vltd 0x4004_0940 0x4004_ffff reserved 0x4005_0000 0x4005_01ff ve 0x4005_0200 0x4005_047f reserved 0x4005_0480 0x4005_04ff pmd 0x4005_0500 0x4007_ffff reserved 0x4008_0000 0x41ff_efff hard fault 0x41ff_f000 0x41ff_f03f flash 0x41ff_f040 0x41ff_ffff reserved
page 4-1 TMPM372FWUG 2013/4/15 4. reset operation 4.1 initial state the internal circuits, register settings and pin status are undefined right after the power-on. the state continues until the reset pin receives "low" level signal after all the power supply voltage is applied. 4.2 reset operation TMPM372FWUG has power-on reset circuit, power-on rese t signal is generated when power supply is turned on. when reset from external reset pin, input reset signa l to reset pin at "low" level for minimum duration of 1.2 sec while power supply voltage is in the operating range. 4.3 after reset when the reset is released, the system control register and the internal i/o register of the cortex-m3 processor core are initialized. note that the pll multiplication circ uit stops after releasing the reset. therefore, set cgosccr register and cgpllsel register to use pll multiplication circuit. after the reset exception handling is executed, the progra m branches off to the interrupt service routine. the address with which the interrupt service routine starts is stored in 0x0000_0004. note 1: it is possible to turn power on after reset pin is set to "low". note 2: the reset operation may alter the internal ram state.
page 4-2 4. reset operation 4.3 after reset TMPM372FWUG 2013/4/15
page 5-1 TMPM372FWUG 2013/4/15 5. clock / mode control 5.1 features the clock/mode control block enables to select clock gear, prescaler clock and warm-up of the pll clock multipli- cation circuit and oscillator. there is also the low power consumption mode which can reduce power consumption by mode transitions. this chapter describes how to control clock operating modes and mode transitions. the clock/mode control block has the following functions: ? controls the system clock ? controls the prescaler clock ? controls the pll multiplication circuit ? controls the warm-up timer in addition to normal mode, the TMPM372FWUG can operate in six types of low power mode to reduce power consumption according to its usage conditions.
page 5-2 5. clock / mode control 5.2 registers TMPM372FWUG 2013/4/15 5.2 registers 5.2.1 register list the following table shows the cg-r elated register s and addresses. base address = 0x4004_0200 register name address (base+) system control register cgsyscr 0x0000 oscillation control register cgosccr 0x0004 standby control register cgstbycr 0x0008 pll selection register cgpllsel 0x000c system clock select register cgcksel 0x0010
page 5-3 TMPM372FWUG 2013/4/15 5.2.2 cgsyscr (system control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000001 15 14 13 12 11 10 9 8 bit symbol - - - fpsel - prck after reset00000000 7 6 5 4 3 2 1 0 bit symbol----- gear after reset00000000 bit bit symbol type function 31-18 ? r read as "0". 17-16 ? r/w write as "01". 15-13 ? r read as "0". 12 fpsel r/w selects fperiph source clock 0: fgear 1: fc 11 ? r read as "0". 10- 8 prck[2:0] r/w prescaler clock 000: fperiph 001: fperiph/2 010: fperiph/4 011: fperiph/8 100: fperiph/16 101: fperiph/32 110: reserved 111: reserved specifies the prescaler clock to peripheral i/o. 7-3 ? r read as "0". 2-0 gear[2:0] r/w high-speed clock (fc) gear 000: fc 001: reserved 010: reserved 011: reserved 100: fc/2 101: fc/4 110: fc/8 111: fc/16
page 5-4 5. clock / mode control 5.2 registers TMPM372FWUG 2013/4/15 5.2.3 cgosccr (oscilla tion control register) 31 30 29 28 27 26 25 24 bit symbol wuodr after reset10000000 23 22 21 20 19 18 17 16 bit symbol wuodr wupsel2 hoscon oscsel xen2 after reset00000001 15 14 13 12 11 10 9 8 bit symbol-------xen1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol----wupsel1pllonwuefwueon after reset00000000
page 5-5 TMPM372FWUG 2013/4/15 note 1: when the is set to "1", the all register s for port m can not be accessed and the read data from these registers are always "0". if one of the port m registers except pmdata and pmod is not equal to the initial value, the can not be set to "1". note 2: do not write "1" to , at the setting of returning from stop mode with automatic warming-up. when warming-up is started by software ( = "1" ), please monitor and confirm warming-up is completed. after turn to "0" operation mode can be changed to stop mode. bit bit symbol type function 31-20 wuodr[11:0] r/w specifies count time of the warm-up timer. 19 wupsel2 r/w clock source for warm-up timer(wup) 0: internal (osc2) 1: external (osc1) select source clock for warm-up timer between external oscillator (osc1) and internal oscillator (osc2). 18 hoscon r/w port m or external oscillator (x1/x2) (note1) 0: port m 1: external oscillator (x1/x2) specifies port m or x1/x2. when the external oscillator (osc1) is used, port m registers (pmcr/pmpup/pmpdn/pmie) should be dis- abled. after reset, the port m registers are disabled. 17 oscsel r/w selection of high-speed oscillator 0: internal (osc2) 1: external (osc1) select high-speed oscillator between external oscillato r (osc1) and internal oscillator (osc2). confirm become "1" then halt the osc2 immediately after switching over to osc1. do not select osc2 again after switching to osc1. 16 xen2 r/w high-speed oscillator2 (internal) 0: stop 1:oscillation specifies operation of the high-speed oscillator 2 (osc2). 15-12 ? r/w write as "0". 11-10 ? r read as "0". 9 ? r/w write as "0". 8 xen1 r/w high-speed oscillator1 (external) 0: stop 1:oscillation specifies operation of the high-speed oscillator 1 (osc1). 7-4 ? r/w read as "0". 3 wupsel1 r/w clock source for warm-up timer write as "0". 2 pllon r/w pll operation 0: stop 1: oscillation specifies operation of the pll. it stops after reset.setting the bit is required. 1 wuef r status of warm-up timer (wup) (note2) 0: warm-up completed. 1: warm-up operation enable to monitor the status of the warm-up timer. 0 wueon w operation of warm-up timer (note2) 0: don't care 1: starting warm-up enables to start the warm-up timer.
page 5-6 5. clock / mode control 5.2 registers TMPM372FWUG 2013/4/15 5.2.4 cgstbycr (standby control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------drve after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------rxen after reset00000001 7 6 5 4 3 2 1 0 bit symbol----- stby after reset00000011 bit bit symbol type function 31-18 ? r read as "0". 17 ? r/w write as "0". 16 drve r/w pin status in stop mode 0: inactive 1: active 15-10 ? r read as "0". 9 ? r/w write as "0". 8 rxen r/w high-speed oscillator operation after releasing the stop mode. write as "1". 7-3 ? r read as "0". 2-0 stby[2:0] r/w low power consumption mode 000: reserved 001: stop 010: reserved 011: idle 100: reserved 101: reserved 110: reserved 111: reserved to enter the stop mode, disable the oscillation (osc1 or osc2) which is unused as system clock.
page 5-7 TMPM372FWUG 2013/4/15 5.2.5 cgpllsel (pll selection register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset10100001 7 6 5 4 3 2 1 0 bit symbol-------pllsel after reset00111110 bit bit symbol type function 31-16 ? r read as "0". 15-12 ? r/w write as "1010". 11 ? r read as "0". 10-1 ? r/w write as "00_1001_1111". 0 pllsel r/w use of pll 0: fosc use 1: pll use specifies use or disuse of the clock multiplied by the pll. "fosc" is automatically set after reset. resetting is required when using the pll.
page 5-8 5. clock / mode control 5.3 clock control TMPM372FWUG 2013/4/15 5.3 clock control 5.3.1 clock type each clock is defined as follows : the high-speed clock fc and the prescaler clock t0 are dividable as follows. 5.3.2 initial values after reset reset operation initializes the clock configuration as follows. reset operation causes all the clock co nfigurations to be the same as f osc2 . fosc1 : clock input from external high-speed oscillator (x1 and x2) fosc2 : clock input from internal high-speed oscillator fosc : high-speed clock specified by cgosccr f pll : clock octupled by pll fc : clock specified by cgpllsel (high-speed clock) fgear : clock specifi ed by cgsyscr fsys : the same clock as fgear (system clock) fperiph : clock specif ied by cgsyscr t0 : clock specified by cgsyscr (prescaler clock) high-speed clock : fc, fc/2, fc/4, fc/8, fc/16 prescaler clock : fperiph, fperiph/2, fperiph/4, fperiph/8, fperiph/16, fperiph/32 high-speed oscillator 1 (external) : stop high-speed oscillator 2 (internal) : oscillating pll (phase locked loop circuit) : stop high-speed clock gear : fc (no frequency dividing) f c = f osc2 f sys = f c ( = f osc2 ) f periph = f c ( = f osc2 ) t0 = f periph ( = f osc2 )
page 5-9 TMPM372FWUG 2013/4/15 5.3.3 clock system diagram figure 5-1 shows the clock system diagram. figure 5-1 clock block diagram the input clocks selector shown with an arrow are set as default after reset. warm-up timer cgosccr cgosccr internal oscillator pll ad conversion clock ofd monitoring clock cgsyscr fgear fperiph (to peripheral i/o) fsys cgpllsel cgosccr external oscillator cgosccr starts oscillation after reset fosc2 cgosccr stops after releasing reset cgosccr stops oscillation after reset f pll = f osc 8 fc cgsyscr peripheral i/o prescaler input  1/32 1/16 1/8 cgsyscr 1/4 1/2 fperiph tt0  systick external refference clock cpu ahb-bus i/o cpu, rom, ram, boot rom io-bus i/o  tmrb, wdt, ve, pmd, sio, adc, port, ofd, enc, vltd fosc1 fosc 1/8 1/4 1/2 1/16 cgosccr 1/32 x2 x1 tmrb, sio
page 5-10 5. clock / mode control 5.3 clock control TMPM372FWUG 2013/4/15 5.3.4 clock multiplication circuit (pll) this circuit outputs the f pll clock that is octuple of the high-speed oscillator output clock (fosc.) as a result, the input frequency to oscillator can be low, and the internal clock be made high-speed. the pll is disabled after reset. to enable the pll, set "1" to the cgosccr bit and set "1" to the cgpllsel. then f pll clock output is octuple of the high-speed oscillator (fosc). the pll requires a certain amount of time to be st abilized, which should be secured using the warm-up functionor other methods. note:it takes approximately 200 s for the pll to be stabilized. 5.3.4.1 the sequence of pll setting the following shows pll setting sequence after reset. figure 5-2 pll sett ing sequence after reset note: when you stop pll, please check that it is the register cgpllsel = "0" after setting up the cgpllsel = "0". then, please set up cgosccr = "0" (pll stoped). initial value after reset cgosccr= 0 (pll stopped) cgpllsel= 0 (fosc selected) cgsyscr= 1/1 (clock gear) need stable high-speed oscillation and power supply voltage. operation flow notes it is possible to use the clock mulitpied . enable pll operation cgosccr= 1 (pll active) pll operation selected cgpllsel= 1 (pll input) it takes approximately 200s for the pll to be stabilized.
page 5-11 TMPM372FWUG 2013/4/15 5.3.5 warm-up function the warm-up function secures the stability time for the oscillator and the pll with the warm-up timer. the warm-up function is used when returning from stop mo de. for detail function, describes in "5.6.6 warm-up". note:do not shift to stop mode, during operating warm-up timer. in this case, an interrupt for returning from the lo w power consumption mode triggers the automatic timer count. after the specified time is reached, the syst em clock is output and the cpu starts operation. in stop modes, the pll is disabled. when returning from these modes, configur e the warm-up time in con- sideration of the stability time of the pll and the internal oscillator. how to configure the warm-up function. 1. specify the count up clock specify the count up clock for the warm -up counter in the cgosccr and bit. ( write "0" to and write "0" or "1 " to . "0" specifies internal oscillator and "1" sp ecifies external oscillator.) 2. specify the warm-up counter value the warm-up time can be selected by setting the cgosccr. the following shows the wa rm-up setting and example. setting 5 ms of warm-up time with 8mhz oscillator drop the last 4 bits, set 0x9c4 into the cgosccr. 3. confirm the start and completion of warm-up the cgosccr is used to conf irm the start and co mpletion of warm-up through software (instruction). note: the warm-up timer operates according to the oscillation clock, and it may contain errors if there is any fluctuation in th e oscillation frequency. therefore, the warm- up time should be taken as approximate time. warm-up cycles = setting value of warm-up time input cycle by frequency(s) setting value of warm-up time input cycle by frequency(s) = 5ms 1/8mhz = 40,000f\fohv 0x9c40
page 5-12 5. clock / mode control 5.3 clock control TMPM372FWUG 2013/4/15 the following shows the warm-up setting. securing the stability time for the pll (fc = fosc1) cgosccr = "0" : write "0" to cgosccr cgosccr = "1" : specify the clock source for warm-up timer cgosccr = "0x9 c4" : warm-up time setting refer to 5.3.6 for the procedure of switching over from the internal oscillator to the external oscillator. cgosccr="1" : enable warm-up counting (wup) read cgosccr : wait until the st ate becomes "0" (warm-up is finished)
page 5-13 TMPM372FWUG 2013/4/15 5.3.6 system clock the TMPM372FWUG offers high-speed clock as system clock. system clock is selectable from internal oscillator or external oscillator. after reset, internal oscillator is enabled and external oscillator is disabled. the high-speed clock is dividable. ? input frequency from x1 and x2 : 8 mhz to 10mhz ? internal oscillator frequency : 10mhz ? clock gear : 1/1, 1/2, 1/4, 1/8, 1/16 (after reset : 1/1) note 1: pll=on/off setting: available in cgosccr. note 2: switching of clock gear is executed when a value is written to the cgsyscr register. the actual switching takes place after a slight delay. note 3: ."-" : reserved note 4: do not use 1/16 when "pll =off" is used. note 5: do not use 1/16 when systick is used. note 6: the maximum operating frequency is 32 mhz when using within the range from 85 to 105 c. be careful not to exceed the maximum operating frequency by dividing system clock when using pll. the following are the procedure of switching over from the internal oscillator to the external oscillator. with setting cgosccr to "1", rewrit ing the portm registers (pmdata/pmcr/pmod/ pmpup/pmpdn/pmie) are prohibited. table 5-1 range of high-speed frequency (unit : mhz) input freq. min. oper- ating freq. max. oper- ating freq. after reset (pll = off, cg = 1/1) clock gear (cg) : pll = on clock gear (cg) : pll = off 1/1 1/2 1/4 1/8 1/16 1/1 1/2 1/4 1/8 1/16 osc1 8 1 80 8 643216848421 - 10 10 80 40 20 10 5 10 5 2.5 1.25 - osc2 10 10 80 40 20 10 5 10 5 2.5 1.25 - 1. disables port m registers (pmcr/pmpup/pmpdn/pmie). after reset, these registers are disabled. 2. cgosccr = "warm-up time" : set warm-up time. 3. cgosccr = "1" : switch over from the port m to oscillator connection pins.. 4. cgosccr = "1" : enable the external oscillator. 5. cgosccr = "1" : specify the external oscillato r clock as source clock for warm-up counter. 6. cgosccr="1" : enable warm-up counting (wup) read cgosccr : wait until the state becomes "0" (warm-up is finished) 7. cgosccr = "1" : switch the system clock to the external oscillator. 8. read cgosccr : confirm cgosccr[17] become "1". (external oscillator is selected.) 9. cgosccr = "0" : internal oscillator is disabled.
page 5-14 5. clock / mode control 5.3 clock control TMPM372FWUG 2013/4/15 5.3.7 prescaler clock control each peripheral function has a prescaler for dividing a clock. as the clock t0 to be input to each prescaler, the "fperiph" clock specified in the cgsyscr can be divided according to the setting in the cgsy- scr. after the controller is reset, fperiph/1 is selected as t0. note:to use the clock gear, ensure that you make the time setting such that prescaler output tn from each periph- eral function is sl ower than fsys ( tn < fsys). do not switch the clock gear while the timer counter or other peripheral function is operating.
page 5-15 TMPM372FWUG 2013/4/15 5.4 modes and mode transitions 5.4.1 mode transitions the normal mode use the high-speed clock for the system clock . the idle and stop modes can be used as the low power consumption mode that enables to reduce power consumption by halting processor core operation. figure 5-3 shows mode transition diagram. for a detail of sleep-on-exit, refer to "cortex-m3 technical reference manual". figure 5-3 mode transition diagram note:the warm-up is needed. the warm-up time must be set in normal mode before changing to stop mode. regarding warm-up time, refer to "5.6.6 warm-up". reset has been performed. interrupt (note) normal mode reset idle mode (stops cpu) (selectable io operation) stop mode (halts all circuit) instruction/ sleep on exit instruction/ sleep on exit interrupt (note)
page 5-16 5. clock / mode control 5.5 operation mode TMPM372FWUG 2013/4/15 5.5 operation mode as an operation mode, normal is av ailable. the features of normal mode are described in the following sec- tion. 5.5.1 normal mode this mode is to operate the cpu core and the pe ripheral hardware by using the high-speed clock. it is shifted to the normal mode after reset.
page 5-17 TMPM372FWUG 2013/4/15 5.6 low power consumption modes the TMPM372FWUG has two low power consumption modes: idle and stop. to shift to the low power con- sumption mode, specify the mode in the system control register cgstby cr and execute the wfi (wait for interrupt) instruction.in this case, execute reset or generate the in terrupt to release the mode. releasing by the interrupt requires settings in advance. see the chapter "exceptions" for details. note 1: the TMPM372FWUG does not offer any event for releas ing the low power consumption mode. transition to the low power consumption mode by executing the wfe (wait for event) instruction is prohibited. note 2: the TMPM372FWUG does not support the low power consumption mode configured with the sleepdeep bit in the cortex-m3 core. setting the bit of the system control register is prohibited. the features of each mode are described as follows. 5.6.1 idle mode only the cpu is stopped in this mode. each peripheral function has one bit in its control register for enabling or disabling operation in the idle mode. when the idle mode is entered, peripheral functions for which operation in the idle mode is disabled stop operation and hold the state at that time. the following peripheral functions can be enabled or disabled in the idle mode. for setting details, see the chapter on each peripheral function. ? 16-bit timer / event counter (tmrb) ? serial channel (sio/uart) ? watchdog timer (wdt) ? vector engine (ve) note:wdt should be stopped before entering idle mode.
page 5-18 5. clock / mode control 5.6 low power consumption modes TMPM372FWUG 2013/4/15 5.6.2 stop mode all the internal circuits including the internal os cillator are brought to a stop in the stop mode. by releasing the stop mode, the de vice returns to the preceding mode of the stop mode and starts opera- tion. the stop mode enables to select the pin status by setting the cgstbycr. table 5-2 shows the pin status in the stop mode. table 5-2 pin states in the stop mode pin name i/o = 0 = 1 not port reset , mode input only x1 input only x2 output only "high" level output tms tck tdi trst input tdo output enabled when data is valid. disabled when data is invalid. swclk input swdio input output enabled when data is valid. disabled when data is invalid. port traceclk tracedata0 tracedata1 swv output uo0 vo0 wo0 xo0 yo0 zo0 output enabled when data is valid. disabled when data is invalid. int3, int4, int5 int6, int7 intc, intd, inte intf input other function pins other than the above or the ports that are used as general purpose ports. input output : input or output enabled. : input or output disabled.
page 5-19 TMPM372FWUG 2013/4/15 5.6.3 low power cons umption mode setting the low power consumption mode is specified by the setting of the standby control register cgst- bycr. table 5-3 shows the mode setting in the . note:do not set any value other than those shown above in . table 5-3 low power consumption mode setting mode cgstbycr stop 001 idle 011
page 5-20 5. clock / mode control 5.6 low power consumption modes TMPM372FWUG 2013/4/15 5.6.4 operational status in each mode table 5-4 shows the operational status in each mode. for i/o port, " " and " " indicate that input/output is enabled and disabled respectively. for other functions, " " and " " indicate that clock is supplied and is not supplied respectively. note 1: it depends on cgstbycr. note 2: the blocks are not stopped even though the clock is halted. 5.6.5 releasing the low power consumption mode the low power consumption mode can be released by an interrupt request, non-maskable interrupt (nmi) or reset. the release source that can be used is dete rmined by the low power consumption mode selected. details are shown in table 5-5. table 5-4 operational status in each mode block normal idle stop processor core ? i/o port ? * (note1) pmd ?? enc ?? ofd ?? adc ?? ve on/off selectable for each module sio ? sbi ? tmrb ? wdt ? vltd ?? (note2) por ?? (note2) cg ?? pll ?? high-speed oscilla- tor (fc) ?? : operating : stopped
page 5-21 TMPM372FWUG 2013/4/15 note 1: to release the low power consumption mode by usi ng the level mode interrupt, keep the level until the inter- rupt handling is started. changing the level before then will prevent the interrupt handling from starting properly. note 2: for shifting to the low power consumption mode, set the cpu to prohibit all the interrupts other than the release source. if not, releasing may be executed by an unspecified for wake up. note 3: refer to "5.6.6 warm-up" about warm-up time. ? release by interrupt request to release the low power consumption mode by an interrupt, the cpu must be set in advance to detect the interrupt. in addition to the setting in the cpu, the clock generator must be set to detect the interrupt to be used to release the stop modes. ? release by non-maskab le interrupt (nmi) there is a watchdog timer interr upt (intwdt) as a non-maskabl e interrupt source. intwdt can only be used in the idle mode. ? release by reset any low power consumption mode can be released by reset from the reset pin. after that, the mode switches to the normal mode and all the regi sters are initialized as is the case with normal reset. ? release by systick interrupt table 5-5 release source in each mode low power consumption mode idle (programable) stop int3 to 8, intc to f (note1) ? intrx0 to 3, inttx0 to 3 ? intvcnb ? intemg1 ? intovv1 ? intadbpda, intadbpdb ? release source interrupt inttb00, 10, 20, 30, 40, 50, 60, 70 inttb01, 11, 21, 31, 41, 51, 61, 71 ? intpmd0, 1 ? intcap00, 10, 20, 30, 40, 50, 60, 70 intcap01, 11, 21, 31, 41, 51, 61, 71 ? intadbcpa, intadbcpb ? intadbsft ? intadbtmr ? intenc1 ? systick ? nmi (intwdt) ? reset ( reset pin) ? : : starts the interrupt handling after the mode is released. (the reset initializes the lsi) unavailable
page 5-22 5. clock / mode control 5.6 low power consumption modes TMPM372FWUG 2013/4/15 systick interrupt can only be used in idle mode. refer to "interrupts" for detail.
page 5-23 TMPM372FWUG 2013/4/15 5.6.6 warm-up mode transition may require the warm-up so that the internal oscillator prov ides stable oscillation. in the mode transition from stop to the normal, the warm-up counter is activated automatically. and then the system clock output is starte d after the elapse of configured warm -up time. it is necessary to set a oscillator to be used for warm-up in the cgos ccr (note1 ) and to set a warm-up time in the cgosccr befo re executing the in struction to ente r the stop mode. note 1: always set cgosccr to "0". note 2: in stop modes, the pll is disabled. when returning from these mode, configure the warm-up time in con- sideration of the stability time of the pll and the internal oscillator. it takes approximately 200 s for the pll to be stabilized. note 3: do not write "1" to cgosccr bit, at th e setting of returning from low consumption mode with automatic warming-up. table 5-6 shows whether the warm-up setting of each mode transition is required or not. table 5-6 warm-up setting in mode transition mode transition warm-up setting normal idle not required normal stop not required idle normal not required stop normal auto-warm-up
page 5-24 5. clock / mode control 5.6 low power consumption modes TMPM372FWUG 2013/4/15 5.6.7 clock operation in mode transition the clock operation in mode transition are described chapter 5.6.7.1 . 5.6.7.1 transition of operation modes : normal stop normal when returning to the normal mode from the stop mode, the warm-up is activated automatically. it is necessary to set the warm-up time before entering the stop mode. returning to the normal mode by reset does not induce the automatic warm-up. keep the reset sig- nal asserted until the oscillat or operation becomes stable. fsys (system clock) stop fosc normal normal mode warm-up system clock stops high-speed clock starts oscillating warm-up starts wfi execute/ sleep on exit release event occurs warm-up completes. system clock starts.
page 6-1 TMPM372FWUG 2013/4/15 6. exceptions this chapter describes features, types and handling of exceptions. exceptions have close relation to the cpu core. refer to "cortex-m3 tec hnical reference manual" if needed. 6.1 overview exceptions have close relation to the cpu core. refer to "cortex-m3 tec hnical reference manual" if needed. there are two types of exceptions: those that are generate d when some error condition occurs or when an instruc- tion to generate an exception is executed; and those that ar e generated by hardware, such as an interrupt request sig- nal from an external pin or peripheral function. all exceptions are handled by the nested vectored inte rrupt controller (nvic) in the cpu according to the respective priority levels. when an excep tion occurs, the cpu stores the current state to the stack and branches to the corresponding interrupt service routine (isr). upon completi on of the isr, the information stored to the stack is automatically restored. 6.1.1 exception types the following types of exceptions exist in the cortex-m3. for detailed descriptions on each exception, refer to "cortex- m3 technical reference manual". ? reset ? non-maskable interrupt (nmi) ? hard fault ? memory management ? bus fault ? usage fault ? svcall (supervisor call) ? debug monitor ? pendsv ?systick ? external interrupt
page 6-2 6. exceptions 6.1 overview TMPM372FWUG 2013/4/15 6.1.2 handling flowchart each step is described later in this chapter. the following shows how an exception/interrupt is handled. in the following descriptions, indicates hardware handling. indicates software handling. processing description see detection by cg/cpu the cg/cpu detects the exception request. section 6.1.2.1 handling by cpu the cpu handles the exception request. section 6.1.2.2 branch to isr the cpu branches to the corresponding interrupt service routine (isr). execution of isr necessary proce ssing is executed. section 6.1.2.4 return from exception the cpu branches to another isr or returns to the previous program. section 6.1.2.4
page 6-3 TMPM372FWUG 2013/4/15 6.1.2.1 exception request and detection (1) exception occurrence exception sources include instruction execution by the cpu, memory accesses, and interrupt requests from external interrupt pins or peripheral functions. an exception occurs when the cpu executes an in struction that causes an exception or when an error condition occurs dur ing instruction execution. an exception also occurs by an in struction fetch from the execute never (xn) region or an access violation to the fault region. an interrupt request is generated from an extern al interrupt pin or peripheral function.for inter- rupts that are used for releasing a standby mode, rele vant settings must be made in the clock genera- tor. for details, refer to "6.5 interrupts". (2) exception detection if multiple exceptions occur simultaneously, the cpu takes the exception with the highest priority. table 6-1 shows the priority of exceptions. "conf igurable" means that you can assign a priority level to that exception. memory management, bus fault and usage fault exceptions can be enabled or disabled. if a disabled exception occurs, it is handled as hard fault. note 1: this product does not contain the mpu. note 2: external interrupts have different sources and numbers in each product. for details, see"6.5.1.5 list of interrupt sources". table 6-1 exception types and priority no. exception type priority description 1 reset ? 3 (highest) reset pin, wdt, por, vltd, ofd or sysretreq 2 non-maskable interrupt ? 2 w d t 3 hard fault ? 1 fault that cannot activate because a higher-priority fault is being han- dled or it is disabled 4 memory management configurable exception from the memory pr otection unit (mpu) (note 1) instruction fetch from the execute never (xn) region 5 bus fault configurable access violation to the hard fault region of the memory map 6 usage fault configurable undefined instruction execution or other faults related to instruction execution 7~10 reserved ? 11 svcall configurable system service call with svc instruction 12 debug monitor configurable debug monitor when the cpu is not faulting 13 reserved ? 14 pendsv configurable pendable system service request 15 systick configurable notification from system timer 16~ external interrupt configurable external in terrupt pin or peripheral function (note2)
page 6-4 6. exceptions 6.1 overview TMPM372FWUG 2013/4/15 (3) priority setting ? priority level the external interrupt priority is set to the interrupt priority register and other exceptions are set to bit in the system handler priority register. the configuration can be changed, and the number of bits required for setting the priority varies from 3 bits to 8 bits dependin g on products. thus, the range of priority values you can specify is different depending on products. in the case of 8-bit configuratio n, the priority can be configured in the range from 0 to 255. the highest priority is "0". if multiple elements with the same priority exist, the smaller the number, the higher the priority becomes. note: bit is defined as a 3-bit configuration with this product. ? priority grouping the priority group can be split into groups. by setting the of the application interrupt and reset control register, can be divided into the pre-emption priority and the sub priority. a priority is compared with th e pre-emption priority. if the pr iority is the same as the pre- emption priority, then it is compared with the sub priority. if the sub priority is the same as the priority, the smaller the exception number, the higher the priority. the table 6-2 shows the priority group setting. the pre-emption priority and the sub prior- ity in the table are the number in the case that is defined as an 8-bit configuration. note: if the configuration of is less than 8 bits, the lower bit is "0". for the example, in the case of 3-bit configuration, the priority is set as and is "00000". table 6-2 priority grouping setting setting number of pre-emption priorities number of subpriorities pre-emption field subpriority field 000 [7:1] [0] 128 2 001 [7:2] [1:0] 64 4 010 [7:3] [2:0] 32 8 011 [7:4] [3:0] 16 16 100 [7:5] [4:0] 8 32 101 [7:6] [5:0] 4 64 110 [7] [6:0] 2 128 111 none [7:0] 1 256
page 6-5 TMPM372FWUG 2013/4/15 6.1.2.2 exception handling and branch to the interrupt service routine (pre-emption) when an exception occurs, the cpu suspends the currently executing pr ocess and branches to the inter- rupt service routine. this is called "pre-emption". (1) stacking when the cpu detects an exception, it pushes the contents of the followin g eight registers to the stack in the following order : ? program counter (pc) ? program status register (xpsr) ?r0 to r3 ?r12 ? link register (lr) the sp is decremented by eight words by the completion of the stack push.the following shows the state of the stack after the regi ster contents have been pushed. (2) fetching an isr the cpu enables instruction to fetch the interrupt processing with data store to the register. prepare a vector table containing the top addresses of isrs for each exception.after reset, the vec- tor table is located at address 0x0000_0000 in the code area.by setting the vector table offset reg- ister, you can place the vector table at any address in the code or sram space. the vector table should also contain the initial value of the main stack. (3) late-arriving if the cpu detects a higher pr iority exception before executing the isr for a previous exception, the cpu handles the higher pr iority exception first. this is called "late-arriving". a late-arriving exception causes the cpu to fetch a new vector address for branching to the corre- sponding isr, but the cpu does not newly push the register contents to the stack. old sp xpsr pc lr r12 r3 r2 r1 sp r0
page 6-6 6. exceptions 6.1 overview TMPM372FWUG 2013/4/15 (4) vector table the vector table is configured as shown below. you must always set the first four words (stack top address, reset isr a ddress, nmi isr address, and hard fault isr address). set isr addr esses for other exceptions if necessary. 6.1.2.3 executing an isr an isr performs necessary processing for the corresponding exception. isrs must be prepared by the user. an isr may need to include code fo r clearing the interrupt request so that the same interrupt will not occur again upon return to normal program execution. for details about interrupt handling, see "6.5 interrupts". if a higher priority exception o ccurs during isr executio n for the current excep tion, the cpu abandons the currently executing isr and serv ices the newly detected exception. offset exception contents setting 0x00 reset initial value of the main stack required 0x04 reset isr address required 0x08 non-maskable interrupt isr address required 0x0c hard fault isr address required 0x10 memory management isr address optional 0x14 bus fault isr address optional 0x18 usage fault isr address optional 0x1c to 0x28 reserved 0x2c svcall isr address optional 0x30 debug monitor isr address optional 0x34 reserved 0x38 pendsv isr address optional 0x3c systick isr address optional 0x40 external interrupt isr address optional
page 6-7 TMPM372FWUG 2013/4/15 6.1.2.4 exception exit (1) execution after re turning from an isr when returning from an isr, the cpu takes one of the following actions : ? tail-chaining if a pending exception exists an d there are no stacked excepti ons or the pending exception has higher priority than all stacked exceptions, the cpu returns to the isr of the pending exception. in this case, the cpu skips the pop of eight re gisters and push of ei ght registers when exit- ing one isr and entering another. this is called "tail-chaining". ? returning to the last stacked isr if there are no pending excepti ons or if the highest priority stacked exception is of higher priority than the highest priority pending excep tion, the cpu returns to the last stacked isr. ? returning to the previous program if there are no pending or st acked exceptions, the cpu retu rns to the previous program. (2) exception exit sequence when returning from an isr, the cpu performs the following operations : ? pop eight registers pops the eight registers (pc, xpsr, r0 to r3, r12 and lr) from the stack and adjust the sp. ? load current active interrupt number loads the current active interrupt number fr om the stacked xpsr. the cpu uses this to track which interrupt to return to. ? select sp if returning to an exception (handler mode), sp is sp_main. if returning to thread mode, sp can be sp_main or sp_process.
page 6-8 6. exceptions 6.2 reset exceptions TMPM372FWUG 2013/4/15 6.2 reset exceptions reset exceptions are generated from the following six sources. use the reset flag (cgrstflg) register of the clock generator to identify the source of a reset. ? external reset pin a reset exception occurs when an external reset pin changes from "low" to "high". ? reset exception by por please refer the chapter "por power on reset circuit" for detail. ? reset exception by vltd please refer the chapter "vltd voltage detection circuit" for detail. ? reset exception by ofd please refer the chapter "ofd oscilla tion frequency detector" for detail. ? reset exception by wdt the watchdog timer (wdt) has a reset generating feature. for details, see the chapter on the wdt. ? reset exception by sysresetreq a reset can be generated by setting the sysresetreq bit in the nvic's application interrupt and reset control register. 6.3 non-maskable interrupts (nmi) the watchdog timer (wdt) has a non-maskable interrupt ge nerating feature. for details, see the chapter on the wdt. use the nmi flag (cgnmiflg) register of the clock generator to identify the source of a non-maskable inter- rupt. 6.4 systick systick provides interrupt features using the cpu's system timer. when you set a value in the systick reload value register and enable the systick features in the systick control and status register, the counter loads with the value set in the reload value register and begins counting down.when the counter reaches "0", a systick exception occurs.you may be pending exceptions and use a flag to know when the timer reaches "0". the systick calibration value register holds a reload value for counting 10 ms with the system timer. the count clock frequency varies with each product, and so the value set in the sy stick calibration value register also varies with each product. note: in this product, fosc which is selected by cgosccr by 32 is used as external referrence clock.
page 6-9 TMPM372FWUG 2013/4/15 6.5 interrupts this chapter describes routes, sources and required settings of interrupts. the cpu is notified of interrupt requests by th e interrupt signal from each interrupt source. it sets priority on interrupts and handles an interrupt request with the highest priority. interrupt requests for clearing a standby mode are notified to the cpu via the clock generator. therefore, appropri- ate settings must be made in the clock generator. 6.5.1 interrupt sources 6.5.1.1 interrupt route figure 6-1 shows an interrupt request route. the interrupts issued by the peripheral function that is not used to release standby are directly input to the cpu (route1). the peripheral function interrupts used to release standby (route 2) and interrupts from the external interrupt pin (route 3) are input to the clock generator and are input to the cpu through the logic for releasing standby (route 4 and 5). if interrupts from the external interrupt pins are not us ed to release standby, they are directly input to the cpu, not through the logic for standby release (route 6). figure 6-1 interrupt route 6.5.1.2 generation an interrupt request is generated from an external pin or peripheral function assigned as an interrupt source or by setting the nvic's interrupt set-pending register. peripheral function cpu exiting standby mode clock generator peripheral function interrupt requestq external interrupt pin 0 1 s r t u v port
page 6-10 6. exceptions 6.5 interrupts TMPM372FWUG 2013/4/15 ? from external pin set the port control register so that the external pin can perform as an interrupt function pin. ? from peripheral function set the peripheral function to make it possible to output interrupt requests. see the chapter of each peri pheral function for details. ? by setting interrupt set-pending register (forced pending) an interrupt request can be generated by setting the relevant bit of the interrupt set-pending register. 6.5.1.3 transmission an interrupt signal from an external pin or peripheral function is directly sent to the cpu unless it is used to exit a standby mode. interrupt requests from interrupt sources that can be used for clearing a standb y mode are transmitted to the cpu via the clock generator. for these interrupt sources, appropriate settings must be made in the clock generator in advance. external interrupt sources not used for exiting a standby mode can be used without setting the clock generator. 6.5.1.4 precautions when using external interrupt pins if you use external interrupts, be aware the followings not to generate unexpected interrupts. if input disabled (pxie="0"), inputs from external interrupt pins are "high". also, if external interrupts are not used as a trigger to release standby (route 6 of figure 6-1), input signals from the exter- nal interrupt pins are directly sent to the cpu. si nce the cpu recognizes "hi gh" input as an interrupt, interrupts occur if corresponding interrupts are enabled by the cpu as inputs are being disabled. to use the external interrupt without setting it as a standby trigger, set the interrupt pin input as "low" and enable it. then, enab le interrupts on the cpu.
page 6-11 TMPM372FWUG 2013/4/15 6.5.1.5 list of interrupt sources table 6-3 shows the list of interrupt sources. table 6-3 list of interrupt sources no. interrupt source active level (clearing standby) cg interrupt mode control register 0 reserved - - - 1 reserved - 2 reserved - 3 int3 interrupt pin high/low edge/level selectable cgimcga 4 int4 interrupt pin high/low edge/level selectable cgimcgb 5 int5 interrupt pin 6 intrx0 serial reception (channel0) 7 inttx0 serial transmit (channel0) 8 intrx1 serial reception (channel1) 9 inttx1 serial transmit (channel1) 10 reserved - 11 intvcnb vector engine interrupt b 12 reserved - 13 intemg1 pmd1 emg interrupt 14 reserved - 15 intovv1 pmd1 ovv interrupt 16 reserved - 17 intadbpda adcb conversion tr iggered by pmd0 is finished 18 reserved - 19 intadbpdb adcb conversion tr iggered by pmd1 is finished 20 inttb00 16bit tmrb0 compare match detection 0/ over flow 21 inttb01 16bit tmrb0 compare match detection 1 22 inttb10 16bit tmrb1 compare match detection 0/ over flow 23 inttb11 16bit tmrb1 compare match detection 1 24 inttb40 16bit tmrb4 compare match detection 0/ over flow 25 inttb41 16bit tmrb4 compare match detection 1 26 inttb50 16bit tmrb5 compare match detection 0/ over flow 27 inttb51 16bit tmrb5 compare match detection 1 28 reserved - 29 intpmd1 pmd1 pwm interrupt 30 intcap00 16bit tmrb0 input capture 0 31 intcap01 16bit tmrb0 input capture 1 32 intcap10 16bit tmrb1 input capture 0 33 intcap11 16bit tmrb1 input capture 1 34 intcap40 16bit tmrb4 input capture 0 35 intcap41 16bit tmrb4 input capture 1 36 intcap50 16bit tmrb5 input capture 0
page 6-12 6. exceptions 6.5 interrupts TMPM372FWUG 2013/4/15 37 reserved - 38 int6 interrupt pin high/low edge/level selectable cgimcgb 39 int7 interrupt pin 40 intrx2 serial reception (channel2) 41 inttx2 serial transmit (channel2) 42 reserved - 43 intadbcpa adcb conversion monitoring function interrupt a 44 reserved - 45 intadbcpb adcb conversion monitoring function interrupt b 46 inttb20 16bit tmrb2 compare match detection 0/ over flow 47 inttb21 16bit tmrb2 compare match detection 1 48 inttb30 16bit tmrb3 compare match detection 0/ over flow 49 inttb31 16bit tmrb3 compare match detection 1 50 intcap20 16bit tmrb2 input capture 0 51 intcap21 16bit tmrb2 input capture 1 52 intcap30 16bit tmrb3 input capture 0 53 intcap31 16bit tmrb3 input capture 1 54 reserved - 55 intadbsft adc unit b conversion started by software is fin- ished 56 reserved - 57 intadbtmr adc unit b conversion triggered by timer is finished 58 int8 interrupt pin high/low edge/level selectable cgimcgc 59 reserved - - - 60 reserved - 61 reserved - 62 reserved - 63 intenc1 encoder input1 interrupt 64 intrx3 serial reception (channel3) 65 inttx3 serial transmit (channel3) 66 inttb60 16bit tmrb6 compare match detection 0/ over flow 67 inttb61 16bit tmrb6 compare match detection 1 68 inttb70 16bit tmrb7 compare match detection 0/ over flow 69 inttb71 16bit tmrb7 compare match detection 1 70 intcap60 16bit tmrb6 input capture 0 71 intcap61 16bit tmrb6 input capture 1 72 intcap70 16bit tmrb7 input capture 0 73 intcap71 16bit tmrb7 input capture 1 74 intc interrupt pin high/low edge/level selectable cgimcgd 75 intd interrupt pin 76 inte interrupt pin 77 intf interrupt pin table 6-3 list of interrupt sources no. interrupt source active level (clearing standby) cg interrupt mode control register
page 6-13 TMPM372FWUG 2013/4/15 6.5.1.6 active level the active level indicates which change in signal of an interrupt source trigge rs an interrupt. the cpu recognizes interrupt signals in "high" level as inte rrupt. interrupt signals directly sent from peripheral functions to the cpu are configured to output "high" to indicate an interrupt request. active level is set to the clock generator for interr upts which can be a trigger to release standby. inter- rupt requests from peripheral functio ns are set as rising-edge or fallin g-edge triggered. interrupt requests from interrupt pins can be set as level-sensitive ("hi gh" or "low") or edge-triggered (rising or falling). if an interrupt source is used for clearing a standby mode, setting the relevant clock generator register is also required. enable the cg imcgx bit and specify the active level in the cgim- cgx bits. you must set the active level fo r interrupt requests from each peripheral function as shown in table 6-3 an interrupt request detected by the clock generator is notified to the cpu with a signal in "high" level.
page 6-14 6. exceptions 6.5 interrupts TMPM372FWUG 2013/4/15 6.5.2 interrupt handling 6.5.2.1 flowchart the following shows how an interrupt is handled. the following shows how an exception/interrupt is handled. in the following descriptions, indicates hardware handling. indicates software handling.
page 6-15 TMPM372FWUG 2013/4/15 processing details see setting for detection set the relevant nvic registers for detecting interrupts. set the clock generator as well if each interrupt source is used to clear a standby mode. common setting nvic registers setting to clear standby mode clock generator "6.5.2.2 preparation" setting for sending interrupt signal execute an appropriate setting to send the interrupt signal depending on the interrupt type. setting for interrupt from external pin port setting for interrupt from peripheral function peripheral function (see the chapter of each peripheral function for details.) interrupt generation an interrupt request is generated. interrupt lines used for clearing a stand by mode are connected to the cpu via the clock generator. "6.5.2.3 detection by clock generator" cpu detects interrupt. the cpu detects the interrupt. "6.5.2.4 detection by cpu" if multiple interrupt requests occur simultaneously, the interrupt request with the highest priority is detected according to the priority order. cpu handles interrupt. the cpu handles the interrupt. "6.5.2.5 cpu process- ing" the cpu pushes register contents to the stack before entering the isr. isr execution program for the isr. clear the interrupt source if needed. "6.5.2.6 interrupt service routine (isr)" return to preceding program configure to return to the preceding program of the isr. cg detects interrupt (clearing standby mode) clearing standby mode not clearing standby mode
page 6-16 6. exceptions 6.5 interrupts TMPM372FWUG 2013/4/15 6.5.2.2 preparation when preparing for an interrupt, you need to pay a ttention to the order of configuration to avoid any unexpected interrupt on the way. initiating an interrupt or changing its configuration must be implemented in the following order basi- cally. disable the interrupt by the cp u. configure from the farthest rout e from the cpu. then enable the interrupt by the cpu. to configure the clock generator, you must follow the order indicated here not to cause any unexpected interrupt. first, configure the precondition. secondly, clear the data related to the interrupt in the clock generator and then enable the interrupt. the following sections are listed in the order of in terrupt handling and describe how to configure them. 1. disabling interrupt by cpu 2. cpu registers setting 3. preconfiguration (1) (inter rupt from external pin) 4. preconfiguration (2) (interrupt from peripheral function) 5. preconfiguration (3) (inter rupt set-pending register) 6. configuring the clock generator 7. enabling interrupt by cpu (1) disabling interrupt by cpu to make the cpu for not accepting any interrupt, write "1" to the corresponding bit of the pri- mask register. all interrupts and exceptions other than non-maskable interrupts and hard faults can be masked. use "msr" instruction to set this register. note 1: primask register cannot be modified by the user access level. note 2: if a fault causes when "1" is set to the primask register, it is treated as a hard fault. (2) cpu registers setting you can assign a priority level by writing to field in an interrupt priority register of the nvic register. each interrupt source is provided w ith eight bits for assigning a priority level from 0 to 255, but the number of bits actually used varies with each product.priority level 0 is the highest priority level.if multiple sources have the same priority, the sma llest-numbered interrupt source has the highest prior- ity. you can assign grouping priority by using the in the application interrupt and reset control register. interrupt mask register primask "1"(interrupt disabled)
page 6-17 TMPM372FWUG 2013/4/15 note: "n" indicates the corresponding exceptions/interrupts. this product uses three bits fo r assigning a priority level. (3) preconfiguration (1) (interrupt from external pin) set "1" to the port function register of the corr esponding pin. setting pxfrn[m] allows the pin to be used as the function pin. setting pxie[m] allows the pin to be used as the input port. note: x: port number / m: corresponding bit / n: function register number in modes other than stop mode, setting pxie to enable input enables the co rresponding interrupt input regardless of the pxfr setting. be careful not to enable interrupts that are not used. also, be aware of the descrip- tion of "6.5.1.4 precautions when using external interrupt pins". (4) preconfiguration (2) (interrupt from peripheral function) the setting varies depending on the peripheral function to be used. see the chapter of each periph- eral function for details. (5) preconfiguration (3) (interrupt set-pending register) to generate an interrupt by using the interrupt set-pending register, set "1" to the corresponding bit of this register. note: m: corresponding bit (6) configuring the clock generator for an interrupt source to be used for exiting a standby mode, you need to set the active level and enable interrupts in the cgimcg register of the cl ock generator. the cgimcg register is capable of configuring each source. before enabling an interr upt, clear the corresponding interrupt request already held. this can avoid unexpected interrupt.to clear co rresponding interrupt request, write a value corresponding to the interrupt to be used to the cg icrcg register.see "6.6.3.5 cgi crcg (cg interrupt request clear register)" for each value. nvic register "prioryty" "group priority" (this is configurable if required.) port register pxfrn "1" pxie "1" nvic register interrupt set-pending [m] "1"
page 6-18 6. exceptions 6.5 interrupts TMPM372FWUG 2013/4/15 interrupt requests from external pins can be used without setting the clock generator if they are not used for exiting a standby mode. however, an "high" pulse or "high"-level signal must be input so that the cpu can detect it as an interrupt request. also, be aware of the description of "6.5.1.4 pre- cautions when using external interrupt pins". note: n: register number / m: number assigned to interrupt source (7) enabling interrupt by cpu enable the interrupt by the cpu as shown below. clear the suspended interrupt in the interrupt clear -pending register. enable the intended interrupt with the interrupt set-enable register. each bit of the register is assigned to a single interrupt source. writing "1" to the corresponding bit of the inte rrupt clear-pending register clears the suspended interrupt. writing "1" to the corresponding bit of the interrupt set-enable register enables the intended interrupt. to generate interrupts in the interrupt set-pending register setting, factors to trigger interrupts are lost if pending interrupts are cleared. thus, this operation is not necessary. at the end, primask re gister is zero cleared. note 1: m : corresponding bit note 2: primask register cannot be modified by the user access level. 6.5.2.3 detection by clock generator if an interrupt source is used for exiting a standby mode, an interrupt request is de tected according to the active level specified in the clock ge nerator, and is notified to the cpu. an edge-triggered interrup t request, once detected, is held in the clock generator. a level-sensitive interrupt request must be held at the active level un til it is detected, otherwise the interrupt request will cease to exist when the signal leve l changes from active to inactive. when the clock generator detects an interrupt request, it keeps sending the interrupt signal in "high" level to the cpu until the interrupt request is cleared in the cg interrupt request clear (cgicrcg) reg- ister. if a standby mode is exited without clearing the interrupt request, the same interrupt will be detected again when normal operation is resumed. be sure to clear each interr upt request in the isr. 6.5.2.4 detection by cpu the cpu detects an interrupt requ est with the highest priority. clock generator register cgimcgn active level cgicrcg value corresponding to the interrupt to be used cgimcgn "1" (interrupt enabled) nvic register interrupt clear-pending [m] "1" interrupt set-pending [m] "1" interrupt mask register primask "0"
page 6-19 TMPM372FWUG 2013/4/15 6.5.2.5 cpu processing on detecting an interrupt, the cpu pushes the contents of pc, psr, r0-r3, r12 and lr to the stack then enter the isr. 6.5.2.6 interrupt service routine (isr) an isr requires specific programmi ng according to the application to be used. this section describes what is recommended at the service routin e programming and how the source is cleared. (1) pushing during isr an isr normally pushes register contents to th e stack and handles an in terrupt as required. the cortex-m3 core automatically push es the contents of pc, psr, r0 -r3, r12 and lr to the stack. no extra programming is required for them. push the contents of ot her registers if needed. interrupt requests wi th higher priority and exceptions such as nmi are accepted even when an isr is being executed. we recommend y ou to push the contents of general-purpose registers that might be rewritten. (2) clearing an interrupt source if an interrupt s ource is used for clearing a standby mode, each interrupt request must be cleared with the cg interrupt request clear (cgicrcg) register. if an interrupt source is set as level-sensitive, an interrupt request continues to exist until it is cleared at its source. therefore, the interrupt source must be cl eared. clearing the interrupt source automatically clears the interrupt reque st signal from the clock generator. if an interrupt is set as edge-sensitive, clear an interrupt request by setting the corresponding value in the cgicrcg register. when an active edge occurs again, a new interrupt request will be detected.
page 6-20 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6 exception / interrupt-related registers the cpu's nvic registers and clock generator registers described in this chapter are shown below with their respective addresses. 6.6.1 register list nvic registers base address = 0xe000_e000 register name address systick control and status register 0x0010 systick reload value register 0x0014 systick current value register 0x0018 systick calibration value register 0x001c interrupt set-enable register 1 0x0100 interrupt set-enable register 2 0x0104 interrupt set-enable register 3 0x0108 interrupt clear-enable register 1 0x0180 interrupt clear-enable register 2 0x0184 interrupt clear-enable register 3 0x0188 interrupt set-pending register 1 0x0200 interrupt set-pending register 2 0x0204 interrupt set-pending register 3 0x0208 interrupt clear-pending register 1 0x0280 interrupt clear-pending register 2 0x0284 interrupt clear-pending register 3 0x0288 interrupt priority register 0x0400 ~ 0x0460 vector table offset register 0x0d08 application interrupt and reset control register 0x0d0c system handler priority r egister 0x0d18, 0x0d1c, 0x0d20 system handler control and state register 0x0d24
page 6-21 TMPM372FWUG 2013/4/15 note:access to the "reserved" areas is prohibited. clock generator register base address = 0x4004_0200 register name address cg interrupt request clear register cgicrcg 0x0014 nmi flag register cgnmiflg 0x0018 reset flag register cgrstflg 0x001c cg interrupt mode control register a cgimcga 0x0020 cg interrupt mode control register b cgimcgb 0x0024 cg interrupt mode control register c cgimcgc 0x0028 cg interrupt mode control register d cgimcgd 0x002c reserved - 0x0030 reserved - 0x0034 reserved - 0x0038 reserved - 0x003c
page 6-22 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.2 nvic registers 6.6.2.1 systick control and status register note: in this product, fosc which is selected by cgoscc r by 32 is used as external referrence clock. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------countflag after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-----clkso urce tickint enable a f t e r r e s e t00000000 bit bit symbol type function 31-17 ? r read as 0. 16 countflag r/w 0: timer not counted to 0 1: timer counted to 0 returns "1" if timer counted to "0" since last time this was read. clears on read of any part of the systick control and status register. 15-3 ? r read as 0. 2 clksource r/w 0: external reference clock (fosc/32) (note) 1: cpu clock (fsys) 1 tickint r/w 0: do not pend systick 1: pend systick 0 enable r/w 0: disable 1: enable if "1" is set, it reloads with the value of the reload value register and starts operation.
page 6-23 TMPM372FWUG 2013/4/15 6.6.2.2 systick reload value register 6.6.2.3 systick correct value register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol reload after reset undefined 15 14 13 12 11 10 9 8 bit symbol reload after reset undefined 7 6 5 4 3 2 1 0 bit symbol reload after reset undefined bit bit symbol type function 31-24 ? r read as 0, 23-0 reload r/w reload value set the value to load into the systick current value register when the timer reaches "0". 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol current after reset undefined 15 14 13 12 11 10 9 8 bit symbol current after reset undefined 7 6 5 4 3 2 1 0 bit symbol current after reset undefined bit bit symbol type function 31-24 ? r read as 0. 23-0 current r/w [read] current systick timer value [write] clear writing to this register with any value clears it to 0. clearing this register also clears the bit of the systick control and status register.
page 6-24 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.2.4 systick calibration value register note: in the case of a multishot, please use -1. 31 30 29 28 27 26 25 24 bit symbolnorefskew------ after reset00000000 23 22 21 20 19 18 17 16 bit symbol tenms after reset00000000 15 14 13 12 11 10 9 8 bit symbol tenms after reset00001001 7 6 5 4 3 2 1 0 bit symbol tenms after reset11000100 bit bit symbol type function 31 noref r 0: reference clock provided 1: no reference clock 30 skew r 0: calibration value is 10 ms. 1: calibration value is not 10ms. 29-24 ? r read as 0. 23-0 tenms r calibration value reload value to use for 10 ms timing (0xc35) by external reffernce clock. (note)
page 6-25 TMPM372FWUG 2013/4/15 6.6.2.5 interrupt set-enable register 1 31 30 29 28 27 26 25 24 bit symbol setena (interrupt 31) setena (interrupt 30) setena (interrupt 29) - setena (interrupt 27) setena (interrupt 26) setena (interrupt 25) setena (interrupt 24) a f t e r r e s e t00000000 23 22 21 20 19 18 17 16 bit symbol setena (interrupt 23) setena (interrupt 22) setena (interrupt 21) setena (interrupt 20) setena (interrupt 19) - setena (interrupt 17) - a f t e r r e s e t00000000 15 14 13 12 11 10 9 8 bit symbol setena (interrupt 15) - setena (interrupt 13) - setena (interrupt 11) - setena (interrupt 9) setena (interrupt 8) a f t e r r e s e t00000000 7 6 5 4 3 2 1 0 bit symbol setena (interrupt 7) setena (interrupt 6) setena (interrupt 5) setena (interrupt 4) setena (interrupt 3) --- a f t e r r e s e t00000000
page 6-26 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". bit bit symbol type function 31-29 setena r/w interrupt number [31:29] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 28 ? r/w write as 0. 27-19 setena r/w interrupt number [27:19] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 18-16 ? r/w write as 0. 15 setena r/w interrupt number [15] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 14 ? r/w write as 0. 13 setena r/w interrupt number [13] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 12 ? r/w write as 0. 11 setena r/w interrupt number [11] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 10 ? r/w write as 0. 9-3 setena r/w interrupt number [9:3] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 2-0 ? r/w write as 0.
page 6-27 TMPM372FWUG 2013/4/15 6.6.2.6 interrupt set-enable register 2 31 30 29 28 27 26 25 24 bit symbol setena (interrupt 63) ---- setena (interrupt 58) setena (interrupt 57) - a f t e r r e s e t00000000 23 22 21 20 19 18 17 16 bit symbol setena (interrupt 55) - setena (interrupt 53) setena (interrupt 52) setena (interrupt 51) setena (interrupt 50) setena (interrupt 49) setena (interrupt 48) a f t e r r e s e t00000000 15 14 13 12 11 10 9 8 bit symbol setena (interrupt 47) setena (interrupt 46) setena (interrupt 45) - setena (interrupt 43) - setena (interrupt 41) setena (interrupt 40) a f t e r r e s e t00000000 7 6 5 4 3 2 1 0 bit symbol setena (interrupt 39) setena (interrupt 38) - setena (interrupt 36) setena (interrupt 35) setena (interrupt 34) setena (interrupt 33) setena (interrupt 32) a f t e r r e s e t00000000
page 6-28 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 bit bit symbol type function 31 setena r/w interrupt number [63] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 30-27 ? r/w write as 0. 26-25 setena r/w interrupt number [58:57] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 24 ? r/w write as 0. 23 setena r/w interrupt number [55] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 22 ? r/w write as 0. 21-13 setena r/w interrupt number [53:45] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 12 ? r/w write as 0. 11 setena r/w interrupt number [43] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 10 ? r/w write as 0. 9-6 setena r/w interrupt number [41:38] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 5 ? r/w write as 0.
page 6-29 TMPM372FWUG 2013/4/15 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 4-0 setena r/w interrupt number [36:32] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. bit bit symbol type function
page 6-30 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.2.7 interrupt set-enable register 3 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol - - setena (interrupt 77) setena (interrupt 76) setena (interrupt 75) setena (interrupt 74) setena (interrupt 73) setena (interrupt 72) a f t e r r e s e t00000000 7 6 5 4 3 2 1 0 bit symbol setena (interrupt 71) setena (interrupt 70) setena (interrupt 69) setena (interrupt 68) setena (interrupt 67) setena (interrupt 66) setena (interrupt 65) setena (interrupt 64) a f t e r r e s e t00000000 bit bit symbol type function 31-14 ? r/w read as 0. 13-0 setena r/w interrupt number [77:64] [write] 1: enable [read] 0: disabled 1: enabled each bit corresponds to the specified number of interrupts. writing "1" to a bit in this register enables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts.
page 6-31 TMPM372FWUG 2013/4/15 6.6.2.8 interrupt clear-enable register 1 31 30 29 28 27 26 25 24 bit symbol clrena (interrupt 31) clrena (interrupt 30) clrena (interrupt 29) - clrena (interrupt 27) clrena (interrupt 26) clrena (interrupt 25) clrena (interrupt 24) a f t e r r e s e t00000000 23 22 21 20 19 18 17 16 bit symbol clrena (interrupt 23) clrena (interrupt 22) clrena (interrupt 21) clrena (interrupt 20) clrena (interrupt 19) - clrena (interrupt 17) - a f t e r r e s e t00000000 15 14 13 12 11 10 9 8 bit symbol clrena (interrupt 15) - clrena (interrupt 13) - clrena (interrupt 11) - clrena (interrupt 9) clrena (interrupt 8) a f t e r r e s e t00000000 7 6 5 4 3 2 1 0 bit symbol clrena (interrupt 7) clrena (interrupt 6) clrena (interrupt 5) clrena (interrupt 4) clrena (interrupt 3) --- a f t e r r e s e t00000000
page 6-32 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 bit bit symbol type function 31-29 clrena r/w interrupt number [31:29] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 28 ? r/w write as 0. 27-19 clrena r/w interrupt number [27:19] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 18-16 ? r/w write as 0. 15 clrena r/w interrupt number [15] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 14 ? r/w write as 0. 13 clrena r/w interrupt number [13] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 12 ? r/w write as 0. 11 clrena r/w interrupt number [11] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 10 ? r/w write as 0. 9-3 clrena r/w interrupt number [9:3] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 2-0 ? r/w write as 0.
page 6-33 TMPM372FWUG 2013/4/15 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources".
page 6-34 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.2.9 interrupt clear-enable register 2 31 30 29 28 27 26 25 24 bit symbol clrena (interrupt 63) ---- clrena (interrupt 58) clrena (interrupt 57) - a f t e r r e s e t00000000 23 22 21 20 19 18 17 16 bit symbol clrena (interrupt 55) - clrena (interrupt 53) clrena (interrupt 52) clrena (interrupt 51) clrena (interrupt 50) clrena (interrupt 49) clrena (interrupt 48) a f t e r r e s e t00000000 15 14 13 12 11 10 9 8 bit symbol clrena (interrupt 47) clrena (interrupt 46) clrena (interrupt 45) - clrena (interrupt 43) - clrena (interrupt 41) clrena (interrupt 40) a f t e r r e s e t00000000 7 6 5 4 3 2 1 0 bit symbol clrena (interrupt 39) clrena (interrupt 38) - clrena (interrupt 36) clrena (interrupt 35) clrena (interrupt 34) clrena (interrupt 33) clrena (interrupt 32) a f t e r r e s e t00000000
page 6-35 TMPM372FWUG 2013/4/15 bit bit symbol type function 31 clrena r/w interrupt number [63] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 30-27 ? r/w write as 0. 26-25 clrena r/w interrupt number [58:57] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 24 ? r/w write as 0. 23 clrena r/w interrupt number [55] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 22 ? r/w write as 0. 21-13 clrena r/w interrupt number [53:45] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 12 ? r/w write as 0. 11 clrena r/w interrupt number [43] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 10 ? r/w write as 0. 9-6 clrena r/w interrupt number [41:38] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 5 ? r/w write as 0.
page 6-36 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 4-0 clrena r/w interrupt number [39:32] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. bit bit symbol type function
page 6-37 TMPM372FWUG 2013/4/15 6.6.2.10 interrupt clear-enable register 3 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 6.6.2.11 interrupt set-pending register 1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol - - clrena (interrupt 77) clrena (interrupt 76) clrena (interrupt 75) clrena (interrupt 74) clrena (interrupt 73) clrena (interrupt 72) a f t e r r e s e t00000000 7 6 5 4 3 2 1 0 bit symbol clrena (interrupt 71) clrena (interrupt 70) clrena (interrupt 69) clrena (interrupt 68) clrena (interrupt 67) clrena (interrupt 66) clrena (interrupt 65) clrena (interrupt 64) a f t e r r e s e t00000000 bit bit symbol type function 31-14 ? r/w read as 0. 13-0 clrena r/w interrupt number [77:64] [write] 1: disabled [read] 0: disabled 1: enable each bit corresponds to the specified number of interrupts. it can be performed to enable interrupts and to check if interrupts are disabled. writing "1" to a bit in this register disables the corresponding interrupt. writing "0" has no effect. reading the bits can see the enable/disable condition of the corresponding interrupts. 31 30 29 28 27 26 25 24 bit symbol setpend (interrupt 31) setpend (interrupt 30) setpend (interrupt 29) - setpend (interrupt 27) setpend (interrupt 26) setpend (interrupt 25) setpend (interrupt 24) after reset undefined undefined undefined undefined undefined undefined undefined undefined 23 22 21 20 19 18 17 16 bit symbol setpend (interrupt 23) setpend (interrupt 22) setpend (interrupt 21) setpend (interrupt 20) setpend (interrupt 19) - setpend (interrupt 17) - after reset undefined undefined undefined undefined undefined undefined undefined undefined 15 14 13 12 11 10 9 8 bit symbol setpend (interrupt 15) - setpend (interrupt 13) - setpend (interrupt 11) - setpend (interrupt 9) setpend (interrupt 8) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol setpend (interrupt 7) setpend (interrupt 6) setpend (interrupt 5) setpend (interrupt 4) setpend (interrupt 3) --- after reset undefined undefined undefined undefined undefined undefined undefined undefined
page 6-38 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 bit bit symbol type function 31-29 setpend r/w interrupt number [31:29] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 28 ? r/w write as 0. 27-19 setpend r/w interrupt number [27:19] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 18-16 ? r/w write as 0. 15 setpend r/w interrupt number [15] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 14 ? r/w write as 0. 13 setpend r/w interrupt number [13] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 12 ? r/w write as 0. 11 setpend r/w interrupt number [11] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 10 ? r/w write as 0.
page 6-39 TMPM372FWUG 2013/4/15 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 9-3 setpend r/w interrupt number [9:3] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 2-0 ? r/w write as 0. bit bit symbol type function
page 6-40 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.2.12 interrupt set-pending register 2 31 30 29 28 27 26 25 24 bit symbol setpend (interrupt 63) ---- setpend (interrupt 58) setpend (interrupt 57) - after reset undefined undefined undefined undefined undefined undefined undefined undefined 23 22 21 20 19 18 17 16 bit symbol setpend (interrupt 55) - setpend (interrupt 53) setpend (interrupt 52) setpend (interrupt 51) setpend (interrupt 50) setpend (interrupt 49) setpend (interrupt 48) after reset undefined undefined undefined undefined undefined undefined undefined undefined 15 14 13 12 11 10 9 8 bit symbol setpend (interrupt 47) setpend (interrupt 46) setpend (interrupt 45) - setpend (interrupt 43) - setpend (interrupt 41) setpend (interrupt 40) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol setpend (interrupt 39) setpend (interrupt 38) - setpend (interrupt 36) setpend (interrupt 35) setpend (interrupt 34) setpend (interrupt 33) setpend (interrupt 32) after reset undefined undefined undefined undefined undefined undefined undefined undefined
page 6-41 TMPM372FWUG 2013/4/15 bit bit symbol type function 31 setpend r/w interrupt number [63] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 30-27 ? r/w write as 0. 26-25 setpend r/w interrupt number [58:57] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 24 ? r/w write as 0. 23 setpend r/w interrupt number [55] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 22 ? r/w write as 0. 21-13 setpend r/w interrupt number [53:45] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 12 ? r/w write as 0. 11 setpend r/w interrupt number [43] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 10 ? r/w write as 0.
page 6-42 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 9-6 setpend r/w interrupt number [41:38] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. 5 ? r/w write as 0. 4-0 setpend r/w interrupt number [36:32] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register. bit bit symbol type function
page 6-43 TMPM372FWUG 2013/4/15 6.6.2.13 interrupt set-pending register 3 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 31 30 29 28 27 26 25 24 bit symbol-------- after reset undefined undefined undefined undefined undefined undefined undefined undefined 23 22 21 20 19 18 17 16 bit symbol-------- after reset undefined undefined undefined undefined undefined undefined undefined undefined 15 14 13 12 11 10 9 8 bit symbol - - setpend (interrupt 77) setpend (interrupt 76) setpend (interrupt 75) setpend (interrupt 74) setpend (interrupt 73) setpend (interrupt 72) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol setpend (interrupt 71) setpend (interrupt 70) setpend (interrupt 69) setpend (interrupt 68) setpend (interrupt 67) setpend (interrupt 66) setpend (interrupt 65) setpend (interrupt 64) after reset undefined undefined undefined undefined undefined undefined undefined undefined bit bit symbol type function 31-14 ? r/w read as 0. 13-0 setpend r/w interrupt number [77:64] [write] 1: pend [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register pends the corresponding interrupt. however, writing "1" has no effect on an interrupt that is already pending or is disabled. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. writing "1" to a corresponding bit in the interrupt cle ar-pending register clears the bit in this register.
page 6-44 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.2.14 interrupt clear-pending register 1 31 30 29 28 27 26 25 24 bit symbol clrpend (interrupt 31) clrpend (interrupt 30) clrpend (interrupt 29) - clrpend (interrupt 27) clrpend (interrupt 26) clrpend (interrupt 25) clrpend (interrupt 24) after reset undefined undefined undefined undefined undefined undefined undefined undefined 23 22 21 20 19 18 17 16 bit symbol clrpend (interrupt 23) clrpend (interrupt 22) clrpend (interrupt 21) clrpend (interrupt 20) clrpend (interrupt 19) - clrpend (interrupt 17) - after reset undefined undefined undefined undefined undefined undefined undefined undefined 15 14 13 12 11 10 9 8 bit symbol clrpend (interrupt 15) - clrpend (interrupt 13) - clrpend (interrupt 11) - clrpend (interrupt 9) clrpend (interrupt 8) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol clrpend (interrupt 7) clrpend (interrupt 6) clrpend (interrupt 5) clrpend (interrupt 4) clrpend (interrupt 3) --- after reset undefined undefined undefined undefined undefined undefined undefined undefined
page 6-45 TMPM372FWUG 2013/4/15 bit bit symbol type function 31-29 clrpend r/w interrupt number [31:29] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 28 ? r/w write as 0. 27-19 clrpend r/w interrupt number [27:19] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 18-16 ? r/w write as 0. 15 clrpend r/w interrupt number [15] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 14 ? r/w write as 0. 13 clrpend r/w interrupt number [13] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 12 ? r/w write as 0. 11 clrpend r/w interrupt number [11] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 10 ? r/w write as 0.
page 6-46 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 9-3 clrpend r/w interrupt number [9:3] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 2-0 ? r/w write as 0. bit bit symbol type function
page 6-47 TMPM372FWUG 2013/4/15 6.6.2.15 interrupt clear-pending register 2 31 30 29 28 27 26 25 24 bit symbol clrpend (interrupt 63) ---- clrpend (interrupt 58) clrpend (interrupt 57) - after reset undefined undefined undefined undefined undefined undefined undefined undefined 23 22 21 20 19 18 17 16 bit symbol clrpend (interrupt 55) - clrpend (interrupt 53) clrpend (interrupt 52) clrpend (interrupt 51) clrpend (interrupt 50) clrpend (interrupt 49) clrpend (interrupt 48) after reset undefined undefined undefined undefined undefined undefined undefined undefined 15 14 13 12 11 10 9 8 bit symbol clrpend (interrupt 47) clrpend (interrupt 46) clrpend (interrupt 45) - clrpend (interrupt 43) - clrpend (interrupt 41) clrpend (interrupt 40) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol clrpend (interrupt 39) clrpend (interrupt 38) - clrpend (interrupt 36) clrpend (interrupt 35) clrpend (interrupt 34) clrpend (interrupt 33) clrpend (interrupt 32) after reset undefined undefined undefined undefined undefined undefined undefined undefined
page 6-48 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 bit bit symbol type function 31 clrpend r/w interrupt number [63] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 30-27 ? r/w write as 0. 26-25 clrpend r/w interrupt number [58:57] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 24 ? r/w write as 0. 23 clrpend r/w interrupt number [55] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 22 ? r/w write as 0. 21-13 clrpend r/w interrupt number [53:45] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 12 ? r/w write as 0. 11 clrpend r/w interrupt number [43] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 10 ? r/w write as 0.
page 6-49 TMPM372FWUG 2013/4/15 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 6.6.2.16 interrupt clear-pending register 3 note: for descriptions of interrupts and interrupt numbers, see section "6.5.1.5 list of interrupt sources". 9-6 clrpend r/w interrupt number [41:38] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 5 ? r/w write as 0. 4-0 clrpend r/w interrupt number [36:32] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. 31 30 29 28 27 26 25 24 bit symbol-------- after reset undefined undefined undefined undefined undefined undefined undefined undefined 23 22 21 20 19 18 17 16 bit symbol-------- after reset undefined undefined undefined undefined undefined undefined undefined undefined 15 14 13 12 11 10 9 8 bit symbol - - clrpend (interrupt 77) clrpend (interrupt 76) clrpend (interrupt 75) clrpend (interrupt 74) clrpend (interrupt 73) clrpend (interrupt 72) after reset undefined undefined undefined undefined undefined undefined undefined undefined 7 6 5 4 3 2 1 0 bit symbol clrpend (interrupt 71) clrpend (interrupt 70) clrpend (interrupt 69) clrpend (interrupt 68) clrpend (interrupt 67) clrpend (interrupt 66) clrpend (interrupt 65) clrpend (interrupt 64) after reset undefined undefined undefined undefined undefined undefined undefined undefined bit bit symbol type function 31-14 ? r/w read as 0. 13-0 clrpend r/w interrupt number [77:64] [write] 1: clear pending interrupt [read] 0: not pending 1: pending each bit corresponds to the specified number can forc e interrupts into the pending state and determines which interrupts are currently pending. writing "1" to a bit in this register clears the correspo nding pending interrupt. however, writing "1" has no effect on an interrupt that is already being serviced. writing "0" has no effect. reading the bit returns the current state of the corresponding interrupts. bit bit symbol type function
page 6-50 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.2.17 interrupt priority register each interrupt is provided with eight b its of an interrupt priority register. the following shows the addresses of the interrupt priority registers corresponding to interrupt num- bers. the number of bits to be used for assigning a priori ty varies with each product. this product uses three bits for assigning a priority. the following shows the fields of the interrupt prior ity registers for interrupt numbers 0 to 3. the inter- rupt priority registers for all other interrupt numbers have the identical fields . unused bits return "0" when read, and writing to unused bits has no effect. 31 24 23 16 15 8 7 0 0xe000_e400 pri_3 ??? 0xe000_e404 pri_7 pri_6 pri_5 pri_4 0xe000_e408 pri_11 ? pri_9 pri_8 0xe000_e40c pri_15 ? pri_13 ? 0xe000_e410 pri_19 ? pri_17 ? 0xe000_e414 pri_23 pri_22 pri_21 pri_20 0xe000_e418 pri_27 pri_26 pri_25 pri_24 0xe000_e41c pri_31 pri_30 pri_29 ? 0xe000_e420 pri_35 pri_34 pri_33 pri_32 0xe000_e424 pri_39 pri_38 ? pri_36 0xe000_e428 pri_43 ? pri_41 pri_40 0xe000_e42c pri_47 pri_46 pri_45 ? 0xe000_e430 pri_51 pri_50 pri_49 pri_48 0xe000_e434 pri_55 ? pri_53 pri_52 0xe000_e438 ? pri_58 pri_57 ? 0xe000_e43c pri_63 ??? 0xe000_e440 pri_67 pri_66 pri_65 pri_64 0xe000_e444 pri_71 pri_70 pri_69 pri_68 0xe000_e448 pri_75 pri_74 pri_73 pri_72 0xe000_e44c ?? pri_77 pri_76 31 30 29 28 27 26 25 24 bit symbol pri_3 ????? a f t e r r e s e t00000000 23 22 21 20 19 18 17 16 bit symbol pri_2 ????? a f t e r r e s e t00000000 15 14 13 12 11 10 9 8 bit symbol pri_1 ????? a f t e r r e s e t00000000 7 6 5 4 3 2 1 0 bit symbol pri_0 ????? a f t e r r e s e t00000000
page 6-51 TMPM372FWUG 2013/4/15 bit bit symbol type function 31-29 pri_3 r/w priority of interrupt number 3 28-24 ? r read as 0, 23-21 pri_2 r/w priority of interrupt number 2 20-16 ? r read as 0, 15-13 pri_1 r/w priority of interrupt number 1 12-8 ? r read as 0, 7-5 pri_0 r/w priority of interrupt number 0 4-0 ? r read as 0,
page 6-52 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.2.18 vector table offset register 31 30 29 28 27 26 25 24 bit symbol - - tblbase tbloff after reset00000000 23 22 21 20 19 18 17 16 bit symbol tbloff after reset00000000 15 14 13 12 11 10 9 8 bit symbol tbloff after reset00000000 7 6 5 4 3 2 1 0 bit symboltbloff------- after reset00000000 bit bit symbol type function 31-30 ? r read as 0, 29 tblbase r/w table base the vector table is in: 0 : code space 1: sram space 28-7 tbloff r/w offset value set the offset value from the top of the space specified in tblbase. the offset must be aligned based on the number of exce ptions in the table.this means that the minimum align- ment is 32 words that you can use for up to 16 interrupt s.for more interrupts, you must adjust the alignment by rounding up to the next power of two. 6-0 ? r read as 0,
page 6-53 TMPM372FWUG 2013/4/15 6.6.2.19 application interrupt and reset control register note 1: little-endian is the default memory format for this product. note 2: when sysresetreq is output, warm reset is pe rformed on this product. is cleared by warm reset. 31 30 29 28 27 26 25 24 bit symbol vectkey/vectkeystat after reset00000000 23 22 21 20 19 18 17 16 bit symbol vectkey/vectkeystat after reset00000000 15 14 13 12 11 10 9 8 bit symbolendianess---- prigroup after reset00000000 7 6 5 4 3 2 1 0 b i t s y m b o l----- sysreset req vectclr active vectreset a f t e r r e s e t00000000 bit bit symbol type function 31-16 vectkey (written) / vectkeystat (read) r/w register key [write] writing to this register requires 0x5fa in the field. [read] read as 0xfa05. 15 endianess r/w endianness bit: (note1) 1: big endian 0: little endianl 14-11 ? r read as 0, 10-8 prigroup r/w interrupt priority grouping 000: seven bits of pre-emption priority, one bit of subpriority 001: six bits of pre-emption priority, two bits of subpriority 010: five bits of pre-emption priority, three bits of subpriority 011: four bits of pre-emption priority, four bits of subpriority 100: three bits of pre-emption priority, five bits of subpriority 101: two bits of pre-emption priority, six bits of subpriority 110: one bit of pre-emption priority, seven bits of subpriority 111: no pre-emption priority, eight bits of subpriority the bit configuration to split the interrupt priority regi ster into pre-emption priority and sub priority. 7-3 ? r read as 0, 2 sysreset req r/w system reset request 1=cpu outputs a sysresetreq signal. (note2) 1vectclr active r/w clear active vector bit 1: clear all state information for active nmi, fault, and interrupts. 0: do not clear. this bit self-clears. it it the responsibility of the a pplication to reinitialize the stack. 0 vectreset r/w system reset bit 1: reset system. 0: do not reset system. resets the system, with the exception of debug component s (fpb, dwt and itm) by setting "1" and this bit is also zero cleared.
page 6-54 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.2.20 system handler priority register each exception is provided with eight bits of a system handler priority register. the following shows the addresses of the system handler priority registers corresponding to each exception. the number of bits to be used for assigning a priori ty varies with each product. this product uses three bits for assigning a priority. the following shows the fields of the system handler priority regi sters for memory management, bus fault and usage fault. unused bits return "0" when read, and writing to unused bits has no effect. 31 24 23 16 15 8 7 0 0xe000_ed18 pri_7 pri_6 (usage fault) pri_5 (bus fault) pri_4 (memory management) 0xe000_ed1c pri_11 (svcall) pri_10 pri_9 pri_8 0xe000_ed20 pri_15 (systick) pri_14 (pendsv) pri_13 pri_12 (debug monitor) 31 30 29 28 27 26 25 24 bit symbol pri_7 ----- after reset00000000 23 22 21 20 19 18 17 16 bit symbol pri_6 ----- after reset00000000 15 14 13 12 11 10 9 8 bit symbol pri_5 ----- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pri_4 ----- after reset00000000 bit bit symbol type function 31-29 pri_7 r/w reserved 28-24 ? r read as 0, 23-21 pri_6 r/w priority of usage fault 20-16 ? r read as 0, 15-13 pri_5 r/w priority of bus fault 12-8 ? r read as 0, 7-5 pri_4 r/w priority of memory management 4-0 ? r read as 0,
page 6-55 TMPM372FWUG 2013/4/15 6.6.2.21 system handler control and state register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 b i t s y m b o l----- usgfault ena busfault ena memfault ena a f t e r r e s e t00000000 15 14 13 12 11 10 9 8 bit symbol svcall pended busfault pended memfault pended usgfault pended systickact pendsvact - monitor act a f t e r r e s e t00000000 7 6 5 4 3 2 1 0 bit symbol svcallact - - - usgfault act - busfault act memfault act a f t e r r e s e t00000000
page 6-56 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 note: you must clear or set the active bits with extreme caut ion because clearing and setting thes e bits does not repair stack c on- tents. bit bit symbol type function 31-19 ? r read as 0, 18 usgfault ena r/w usage fault 0: disabled 1: enabled 17 busfaul tena r/w bus fault 0: disable 1: enable 16 memfault ena r/w memory management 0: disable 1: enable 15 svcall pended r/w svcall 0: not pended 1: pended 14 busfault pended r/w bus fault 0: not pended 1: pended 13 memfault pended r/w memory management 0: not pended 1: pended 12 usgfault pended r/w usage fault 0: not pended 1: pended 11 systickact r/w systick 0: inactive 1: active 10 pendsvact r/w pendsv 0: inactive 1: active 9 ? r read as 0, 8 monitoract r/w debug monitor 0: inactive 1: active 7 svcallact r/w svcall 0: inactive 1: active 6-4 ? r read as 0, 3usgfault act r/w usage fault 0: inactive 1: active 2 ? r read as 0, 1 busfault act r/w bus fault 0: inactive 1: active 0memfault act r/w memory management 0: inactive 1: active
page 6-57 TMPM372FWUG 2013/4/15 6.6.3 clock generator registers 6.6.3.1 cgimcga (cg interrupt mode control register a) 31 30 29 28 27 26 25 24 bit symbol - emcg3 emst3 - int3en after reset001000undefined0 23 22 21 20 19 18 17 16 bit symbol----- -- after reset001000undefined0 15 14 13 12 11 10 9 8 bit symbol----- -- after reset001000undefined0 7 6 5 4 3 2 1 0 bit symbol----- -- after reset001000undefined0 bit bit symbol type function 31 ? r read as 0. 30-28 emcg3[2:0] r/w active level setting of int3 standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 27-26 emst3[1:0] r active level of int3 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 25 ? r reads as undefined. 24 int3en r/w int3 clear input 0: disable 1: enable 23 ? r read as 0. 22-20 ? r/w write optional value. 19-18 ? r read as 0. 17 ? r read as undefined. 16 ? r/w write as 0. 15 ? r read as 0. 14-12 ? r/w write optional value. 11-10 ? r read as 0. 9 ? r read as undefined. 8 ? r/w write as 0. 7 ? r read as 0. 6-4 ? r/w write optional value. 3-2 ? r read as 0. 1 ? r read as undefined. 0 ? r/w write as 0.
page 6-58 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 note 1: is effective only when is set to "100" for both rising and falling edge. the active level used for the reset of standby can be checked by referring . if interrupts are cleared with the cgicrcg register, is also cleared. note 2: please specify the bit for the edge first and then specify the bit for the . setting them simultaneously is proh ib- ited.
page 6-59 TMPM372FWUG 2013/4/15 6.6.3.2 cgimcgb (cg interrupt mode control register b) 31 30 29 28 27 26 25 24 bit symbol - emcg7 emst7 - int7en after reset001000undefined0 23 22 21 20 19 18 17 16 bit symbol - emcg6 emst6 - int6en after reset001000undefined0 15 14 13 12 11 10 9 8 bit symbol - emcg5 emst5 - int5en after reset001000undefined0 7 6 5 4 3 2 1 0 bit symbol - emcg4 emst4 - int4en after reset001000undefined0
page 6-60 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15
page 6-61 TMPM372FWUG 2013/4/15 bit bit symbol type function 31 ? r read as 0. 30-28 emcg7[2:0] r/w active level setting of int7 standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 27-26 emst7[1:0] r active level of int7 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 25 ? r reads as undefined. 24 int7en r/w int7 clear input 0: disable 1: enable 23 ? r read as 0. 22-20 emcg6[2:0] r/w active level setting of int6 standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 19-18 emst6[1:0] r active level of int6 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 17 ? r reads as undefined. 16 int6en r/w int6 clear input 0:disable 1: enable 15 ? r read as 0. 14-12 emcg5[2:0] r/w active level setting of int5 standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 11-10 emst5[1:0] r active level of int5 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 9 ? r reads as undefined. 8 int5en r/w int5 clear input 0: disable 1: enable 7 ? r read as 0. 6-4 emcg4[2:0] r/w active level setting of int4 standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 3-2 emst4[1:0] r active level of int4 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 1 ? r reads as undefined.
page 6-62 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 note 1: is effective only when is set to "100" for both rising and falling edge. the active level used for the reset of standby can be checked by referring . if interrupts are cleared with the cgicrcg register, is also cleared. note 2: please specify the bit for the edge first and then specify the bit for the . setting them simultaneously is proh ib- ited. 0 int4en r/w int4 clear input 0: disable 1: enable bit bit symbol type function
page 6-63 TMPM372FWUG 2013/4/15 6.6.3.3 cgimcgc (cg interrupt mode control register c) note 1: is effective only when is set to "100" for both rising and falling edge. the active level used for the reset of standby can be checked by referring . if interrupts are cleared with the cgicrcg register, is also cleared. 31 30 29 28 27 26 25 24 bit symbol-------- after reset001000undefined0 23 22 21 20 19 18 17 16 bit symbol-------- after reset001000undefined0 15 14 13 12 11 10 9 8 bit symbol-------- after reset001000undefined0 7 6 5 4 3 2 1 0 bit symbol - emcg8 emst8 - int8en after reset001000undefined0 bit bit symbol type function 31 ? r read as 0. 30-28 ? r/w write optional value. 27-26 ? r read as 0. 25 ? r read as undefined. 24 ? r/w write as 0. 23 ? r read as 0. 22-20 ? r/w write optional value. 19-18 ? r read as 0. 17 ? r read as undefined. 16 ? r/w write as 0. 15 ? r read as 0. 14-12 ? r/w write optional value. 11-10 ? r read as 0. 9 ? r read as undefined. 8 ? r/w write as 0. 7 ? r read as 0. 6-4 emcg8[2:0] r/w active level setting of int8 standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 3-2 emst8[1:0] r active level of int8 standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 1 ? r reads as undefined. 0 int8en r/w int8 clear input 0: disable 1: enable
page 6-64 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 note 2: please specify the bit for the edge first and then specify the bit for the . setting them simultaneously is proh ib- ited. 6.6.3.4 cgimcgd (cg interrupt mode control register d) 31 30 29 28 27 26 25 24 bit symbol - emcgf emstf - intfen after reset001000undefined0 23 22 21 20 19 18 17 16 bit symbol - emcge emste - inteen after reset001000undefined0 15 14 13 12 11 10 9 8 bit symbol - emcgd emstd - intden after reset001000undefined0 7 6 5 4 3 2 1 0 bit symbol - emcgc emstc - intcen after reset001000undefined0
page 6-65 TMPM372FWUG 2013/4/15 bit bit symbol type function 31 ? r read as 0. 30-28 emcgf[2:0] r/w active level setting of intf standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 27-26 emstf[1:0] r active level of intf standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 25 ? r reads as undefined. 24 intfen r/w intf clear input 0: disable 1: enable 23 ? r read as 0. 22-20 emcge[2:0] r/w active level setting of inte standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 19-18 emste[1:0] r active level of inte standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 17 ? r reads as undefined. 16 inteen r/w inte clear input 0: disable 1: enable 15 ? r read as 0. 14-12 emcgd[2:0] r/w active level setting of intd standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 11-10 emstd[1:0] r active level of intd standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 9 ? r reads as undefined. 8 intden r/w intd clear input 0: disable 1: enable 7 ? r read as 0. 6-4 emcgc[2:0] r/w active level setting of intc standby clear request. (101 to 111: setting prohibited) 000: "low" level 001: "high" level 010: falling edge 011: rising edge 100: both edge 3-2 emstc[1:0] r active level of intc standby clear request 00: ? 01: rising edge 10: falling edge 11: both edge 1 ? r reads as undefined.
page 6-66 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 note 1: is effective only when is set to "100" for both rising and falling edge. the active level used for the reset of standby can be checked by referring . if interrupts are cleared with the cgicrcg register, is also cleared. note 2: please specify the bit for the edge first and then specify the bit for the . setting them simultaneously is proh ib- ited. 0 intcen r/w intc clear input 0: disable 1: enable bit bit symbol type function
page 6-67 TMPM372FWUG 2013/4/15 6.6.3.5 cgicrcg (cg interrupt request clear register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - icrcg after reset00000000 bit bit symbol type function 31-5 ? r read as 0, 4-0 icrcg[4:0] w clear interrupt requests. 0_0000:reserved 0_1000: int8 0_0001: reserved 0_1001: reserved 0_0010: reserved 0_1010:reserved 0_0011: int3 0_1011: reserved 0_0100: int4 0_1100:intc 0_0101: int5 0_1101: intd 0_0110: int6 0_1110: inte 0_ 0111: int7 0_1111: intf 1_0000 to 1_ 1111: reserved read as 0.
page 6-68 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15 6.6.3.6 cgnmiflg (nmi flag register) note: are cleared to "0" when they are read. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------nmiflg0 after reset00000000 bit bit symbol type function 31-1 ? r read as 0. 0 nmiflg0 r nmi source generation flag 0: not applicable 1: generated from wdt
page 6-69 TMPM372FWUG 2013/4/15 6.6.3.7 cgrstflg (reset flag register) note 1: this flag indicates a reset generated by the sysresetreq bit of the application interrupt and reset control register of the cpu's nvic. note 2: this product has power-on reset circui t and this register is initialized only by power-on reset. therefore, "1" is set t o the bit in initial reset state right after power-on. note that this bit is not set by the second and subsequent resets and this register is not cleared automatically. write "0" to clear the register. 31 30 29 28 27 26 25 24 b i t s y m b o l-------- after power-on reset 00000000 23 22 21 20 19 18 17 16 b i t s y m b o l-------- after power-on reset 00000000 15 14 13 12 11 10 9 8 b i t s y m b o l-------- after power-on reset 00000000 7 6 5 4 3 2 1 0 bit symbol - - ofdrstf dbgrstf vltdrstf wdtrstf pinrstf ponrstf after power-on reset 00000001 bit bit symbol type function 31-6 ? r read as 0. 5 ofdrstf r/w ofd reset flag (note1) 0: "0" is written 1: reset from ofd 4 dbgrstf r/w debug reset flag (note1) 0: "0" is written 1: reset from sysresetreq 3 vltdrstf r/w vltd reset flag 0: "0" is written 1: reset from vltd 2 wdtrstf r/w wdt reset flag 0: "0" is written 1: reset from wdt 1 pinrstf r/w reset pin flag 0: "0" is written 1: reset from reset pin 0 ponrstf r/w power-on flag 0: "0" is written 1: reset from power-on reset
page 6-70 6. exceptions 6.6 exception / interrupt-related registers TMPM372FWUG 2013/4/15
page 7-1 TMPM372FWUG 2013/4/15 7. internal high-speed oscill ation adjustment function TMPM372FWUG has the internal high-speed oscillation adjustment function. note: this adjustment function is not app licable to the reference clock for ofd. 7.1 structure the internal oscillation adjustment function uses the pulse width measurement function of 16-bit timer/event counter (tmrb). figure 7-1 shows the function configuration. figure 7-1 functi on block diagram cpu tmrb internal high-speed oscillator trimoscinit trimoscset trimoscen clock initial vaiue read trimming data set capture interrupt %crvwtgtgikuvgttgcf tbxin
page 7-2 7. internal high-speed oscillation adjustment func- tion 7.2 registers TMPM372FWUG 2013/4/15 7.2 registers 7.2.1 register list the control registers and its addresses are as follows. 7.2.2 trmoscpro (p rotect register) base address = 0x4004 _ 0300 register name address(base+) protect register trmoscpro 0x0000 enable register trmoscen 0x0004 initial trimming value monitoring register trmoscinit 0x0008 trimming value setting register trmoscset 0x000c 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol protect after reset00000000 bit bit symbol type ?@?\ 31-8 ? r read as "0". 7-0 ? r/w writing register control 0xc1 : enable other than 0xc1 : desable when "0xc1" is set, trmoscen, trmoscin it and trmoscset are allowed to write.
page 7-3 TMPM372FWUG 2013/4/15 7.2.3 trmoscen (e nable register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-----tbprun-tbrun after reset00000000 bit bit symbol type ?@?\ 31-1 ? r read as "0". 0 trimen r/w trimming control 0 : disable 1 : enable when "1" is set, a trimming value of the internal oscillator is switched from a value of trimoscinit to a value of trmoscset.
page 7-4 7. internal high-speed oscillation adjustment func- tion 7.2 registers TMPM372FWUG 2013/4/15 7.2.4 trmoscinit (initial tr imming value monitor register) for details about the specific setting and adjustment va lue of coarse trimming and fine trimming, refer to "table 7-1 adjustment range". 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol - - triminitc after reset 0 0 undifined 7 6 5 4 3 2 1 0 bit symbol---- triminitf after reset0000 undifined bit bit symbol type ?@?\ 31-14 ? r read as "0". 13-8 triminitc r/w initial coarse trimmng value enables to monitor initial coarse trimming value. 7-4 ? r read as "0". 3-0 triminitf r/w initial fine trimming value enables to monitor initial fine trimming value.
page 7-5 TMPM372FWUG 2013/4/15 7.2.5 trmoscset (trimmin g value setting register) for details about the specific setting and adjustment va lue of coarse trimming and fine trimming, refer to "table 7-1 adjustment range". 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol - - trimsetc after reset00000000 7 6 5 4 3 2 1 0 bit symbol---- trimsetf after reset00100000 bit bit symbol type ?@?\ 31-14 ? r read as "0". 13-8 tbrswr r/w coarse trimmng value setting sets the coarse trimming value. 7-4 ? r read as "0". 3-0 tbclk[1:0] r/w fine trimmng value setting sets the fine trimming value.
page 7-6 7. internal high-speed oscillation adjustment func- tion 7.3 operational description TMPM372FWUG 2013/4/15 7.3 operational description 7.3.1 outline oscillation is adjusted using coarse trim ming values and fine trimming values. the value setting before shipping can be check ed with trmoscinit and . when the value changing, set a new value to trmo scset and . by setting "1" to trmoscen, a setting value of the internal oscillator will be changed. note:after reset, writing to trmoscset and trmoscen is prohibited. when writing to these bits, trmoscpro must be set to "0xc1". 7.3.2 adjustment range in the coarse trimming, ? 57.6% to + 55.8% adjustment by 1.8%-step is feasible. in the fine trimming, ? 2.4% to + 2.1% adjustment by 0.3%-step is feasible. table 7-1 shows a adjustment range. note:each step value is assumed based on the typi cal condition. in the coarse trimming, it has 0.2% margin of error. in the fine trimming, it has 0.1% margin of error. 7.3.3 internal oscillation frequency measurement using tmrb to measure a frequency of high-speed oscillator, the pulse width measurement function of tmrb can be used. first, choose an internal oscillator as a prescaler clock t0 of tmrb. second, input a pulse from tbxin. third, capture an up-counter value at the rising edge of the pulse using the capture function. finally, determine the adjustment value using a difference between a frequency of tbxin calculated with capture value and the actual frequency. table 7-1 adjustment range coarse trimming fine trimming frequency change (typ.) frequency change (typ.) 011111 + 55.8% 0111 + 2.1% ?? ?? 000001 + 1.8% 0001 + 0.3% 000000 0% 0000 0% 111111 ? 1.8% 1111 ? 0.3% 111110 ? 3.6% 1110 ? 0.6% ?? ?? 100000 ? 57.6% 1000 ? 2.4%
page 8-1 TMPM372FWUG 2013/4/15 8. input / output ports 8.1 port functions 8.1.1 function list TMPM372FWUG has 53 ports.besides the ports function, these ports can be used as i/o pins for peripheral functions. table 8-1 shows the port function table. table 8-1 port function list port pin input /out- put pull-up pull-down schmitt input noise fil- ter program- mable open- drain function pin porta pa0 i/o pull-up / pull-down ?? tb0in , int3 pa1 i/o pull-up / pull-down - tb0out pa2 i/o pull-up / pull-down ?? tb1in , int4 pa3 i/o pull-up / pull-down - tb1out pa4 i/o pull-up / pull-down - sclk1 , cts1 pa5 i/o pull-up / pull-down - txd1 , tb6out pa6 i/o pull-up / pull-down - rxd1 , tb6in pa7 i/o pull-up / pull-down ?? tb4in , int8 portb pb0 i/o pull-up / pull-down - traceclk pb1 i/o pull-up / pull-down - tracedata0 pb2 i/o pull-up / pull-down - tracedata1 pb3 i/o pull-up / pull-down - tms / swdio pb4 i/o pull-up / pull-down - tck / swclk pb5 i/o pull-up / pull-down - tdo / swv pb6 i/o pull-up / pull-down - tdi pb7 i/o pull-up / pull-down ?? trst portd pd4 i/o pull-up / pull-down - sclk2 , cts2 pd5 i/o pull-up / pull-down - txd2 pd6 i/o pull-up / pull-down - rxd2 porte pe0 i/o pull-up / pull-down - txd0 pe1 i/o pull-up / pull-down - rxd0 pe2 i/o pull-up / pull-down - sclk0 , cts0 pe3 i/o pull-up / pull-down - tb4out pe4 i/o pull-up / pull-down ?? tb2in , int5 pe5 i/o pull-up / pull-down - tb2out : exist - : not exist
page 8-2 8. input / output ports 8.1 port functions TMPM372FWUG 2013/4/15 note:the noise elimination width of the noise fi lter is approximately 30 ns under typical conditions. pe6 i/o pull-up / pull-down ?? tb3in , int6 pe7 i/o pull-up / pull-down ?? tb3out , int7 portf pf0 i/o pull-up / pull-down - tb7in , boot pf1 i/o pull-up / pull-down - tb7out pf2 i/o pull-up / pull-down - enca1 , sclk3 , cts3 pf3 i/o pull-up / pull-down - encb1 , txd3 pf4 i/o pull-up / pull-down - encz1 , rxd3 portg pg0 i/o pull-up / pull-down - uo1 pg1 i/o pull-up / pull-down - xo1 pg2 i/o pull-up / pull-down - vo1 pg3 i/o pull-up / pull-down - yo1 pg4 i/o pull-up / pull-down - wo1 pg5 i/o pull-up / pull-down - zo1 pg6 i/o pull-up / pull-down - emg1 pg7 i/o pull-up / pull-down - ovv1 porti pi3 i/o pull-up / pull-down - aina11 / ainb2 portj pj0 i/o pull-up / pull-down - ainb3 pj1 i/o pull-up / pull-down - ainb4 pj2 i/o pull-up / pull-down - ainb5 pj3 i/o pull-up / pull-down - ainb6 pj4 i/o pull-up / pull-down - ainb7 pj5 i/o pull-up / pull-down - ainb8 pj6 i/o pull-up / pull-down ?? intc , ainb9 pj7 i/o pull-up / pull-down ?? intd , ainb10 portk pk0 i/o pull-up / pull-down ?? inte , ainb11 pk1 i/o pull-up / pull-down ?? intf , ainb12 portm pm0 i/o pull-up / pull-down - x1 pm1 i/o pull-up / pull-down - x2 table 8-1 port function list port pin input /out- put pull-up pull-down schmitt input noise fil- ter program- mable open- drain function pin : exist - : not exist
page 8-3 TMPM372FWUG 2013/4/15 8.1.2 port registers outline the following registers need to be configured to use ports. ? pxdata: port x data register to read / write port data. ? pxcr: port x output control register to control output. pxie needs to be configured to control input. ? pxfrn: port x function register n to set function. an assigned function can be activated by setting "1". ? pxod: port x open drain control register to control the programmable open drain. programmable open drain is function to be mate rialized pseudo-open-drain by setting the pxod. when pxod is set "1",output buffer is disabled and pseudo-open-drain is materialized. ? pxpup: port x pull-up control register to control programmable pull ups. ? pxpdn: port x pull-down control register to control programmable pull downs. ? pxie:port x input control register to control inputs. for avoided through current, default setting prohibits inputs.
page 8-4 8. input / output ports 8.1 port functions TMPM372FWUG 2013/4/15 8.1.3 port states in stop mode input and output in stop mode are enable d / disabled by the cgstbycr bit. if pxie or pxcr is enabled with =1, input or output is enabled respectively in stop mode. if=0, both input and output are disabled in st op mode except for some por ts even if pxie or pxcr are enabled. table 8-2 shows the pin conditions in stop mode. table 8-2 port conditions in stop mode pin name i/o = 0 = 1 not port reset , mode input only port x1 input only x2 output only "high" level output tms tck tdi trst input tdo output enabled when data is valid. disabled when data is invalid. swclk input swdio input output enabled when data is valid. disabled when data is invalid. traceclk tracedata0 tracedata1 swv output uo1 vo1 wo1 xo1 yo1 zo1 output enabled when data is valid. disabled when data is invalid. int3, int4, int5 int6, int7, int8 intb intc, intd, inte intf input other function pins other than the above or the ports that are used as general purpose ports. input output : input or output enabled. : input or output disabled.
page 8-5 TMPM372FWUG 2013/4/15 8.2 port functions this chapter describes the port registers detail. this chapter describes only "circuit type" reading circuit configuration. for detailed circuit diagram, refer to"8.3 block diagrams of ports". 8.2.1 port a (pa0 to pa7) the port a is a general-purpose, 8-bit input / output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purp ose input / output functi on, the port a performs the serial interface func- tion (sio / uart), the external signal interrup t input, the 16-bit timer input/output function. reset initializes all bits of the port a as general- purpose ports with input, output, pull-up and pull-down dis- abled. the port a has two types of function register. if you us e the port a as a general-purpose port, set "0" to the corresponding bit of the two registers.if you use the port a as other than a general-purpose port, set "1" to the corresponding bit of the function register.do not set "1 " to the some function registers at the same time. to use the external interrupt input for releasing stop mode, select this function in the pafr and enable input in the paie register. these settings enable the interrupt input even if the cgstbycr bit in the clock / mode control block is set to stop driving of pins during stop mode. note:in modes other than stop mode, interrupt input is enabl ed regardless of the pxfr register setting if input is enabled in pxie. make sure to disable unused interrupts when programming the device. 8.2.1.1 port a circuit type 8.2.1.2 porta register 76543210 type t12 t11 t13 t9 t2 t12 t2 t12 base address = 0x4000_0000 register name address (base+) port a data register padata 0x0000 port a output control register pacr 0x0004 port a function register 1 pafr1 0x0008 port a function register2 pafr2 0x000c port a open drain control register paod 0x0028 port a pull-up control register papup 0x002c port a pull-down control register papdn 0x0030 port a input control register paie 0x0038
page 8-6 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.1.3 padata (port a data register) 8.2.1.4 pacr (port a output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pa6 pa5 pa4 pa3 pa2 pa1 pa0 after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pa7 to pa0 r/w port a data register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pa7c pa6c pa5c pa4c pa3c pa2c pa1c pa0c after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pa7c to pa0c r/w output 0: disable 1: enable
page 8-7 TMPM372FWUG 2013/4/15 8.2.1.5 pafr1 (port a function register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pa7f1 pa6f1 pa5f1 pa4f1 pa3f1 pa2f1 pa1f1 pa0f1 after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 pa7f1 r/w 0 : port 1 : tb4in 6 pa6f1 r/w 0: port 1: rxd1 5 pa5f1 r/w 0: port 1: txd1 4 pa4f1 r/w 0: port 1: sclk1 3 pa3f1 r/w 0: port 1: tb1out 2 pa2f1 r/w 0: port 1: tb1in 1 pa1f1 r/w 0: port 1: tb0out 0 pa0f1 r/w 0: port 1: tb0in
page 8-8 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.1.6 pafr2 (port a function register 2) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pa7f2 pa6f2 pa5f2 pa4f2 - pa2f2 - pa0f2 after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 pa7f2 r/w 0 : port 1 : int8 6 pa6f2 r/w 0: port 1: tb6in 5 pa5f2 r/w 0: port 1: tb6out 4 pa4f2 r/w 0: port 1: cts1 3 ? r read as 0. 2 pa2f2 r/w 0: port 1: int4 1 ? r read as 0. 0 pa0f2 r/w 0: port 1: int3
page 8-9 TMPM372FWUG 2013/4/15 8.2.1.7 paod (port a open drain control register) 8.2.1.8 papup (port a pull-up control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pa7od pa6od pa5od pa4od pa3od pa2od pa1od pa0od after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pa7od to pa0od r/w 0 : cmos 1 : open-drain 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pa7up pa6up pa5up pa4up pa3up pa2up pa1up pa0up after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pa7up to pa0up r/w pull-up 0: disable 1: enable
page 8-10 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.1.9 papdn (port a pull-down control register) 8.2.1.10 paie (port a input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pa7dn pa6dn pa5dn pa4dn pa3dn pa2dn pa1dn pa0dn after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pa7dn to pa0dn r/w pull-down 0: disable 1: enable 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pa7ie pa6ie pa5ie pa4ie pa3ie pa2ie pa1ie pa0ie after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pa7ie to pa0ie r/w input 0: disable 1: enable
page 8-11 TMPM372FWUG 2013/4/15 8.2.2 port b (pb0 to pb7) the port b is a general-purpose, 8-bit input / output port.for this port, inputs and outputs can be specified in units of bits. besides the general-pu rpose input / output function, the port b performs the debug interface func- tion and the debug tr ace output function. reset initializes pb3, pb4, pb5, pb6 an d pb7 to perform debug interface function. when pb3 functions as the tms or swdio, input, ou tput and pull-up are enable d. when pb4 functions as the tck or swclk, input, pull-down are enabled. when pb5 functions as the tdo or swv, output is enabled. when pb6 functions tdi, input, pull-up are enabled. when pb7 functions as trst input, pull-up is enabled. pb0, pb1, pb2 perform as the general-purpose port s with input, output, pull-up, pull-down disabled. note:if pb3 is configured as the tms/swdio pin, output is enabled even in stop mode regardless of the cgst- bycr bit setting. 8.2.2.1 port b circuit type 8.2.2.2 port b register 76543210 type t7 t7 t19 t8 t6 t18 t18 t18 base address = 0x4000_0040 register name address(base+) port b data register pbdata 0x0000 port b output control register pbcr 0x0004 port b function register 1 pbfr1 0x0008 port b open drain control register pbod 0x0028 port b pull-up control register pbpup 0x002c port b pull-down control register pbpdn 0x0030 port b input control register pbie 0x0038
page 8-12 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.2.3 pbdata (port b data register) 8.2.2.4 pbcr (port b output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7 to pb0 r/w port b data register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pb7c pb6c pb5c pb4c pb3c pb2c pb1c pb0c after reset00101000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7c to pb0c r/w output 0: disable 1: enable
page 8-13 TMPM372FWUG 2013/4/15 8.2.2.5 pbfr1 (port b function register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pb7f1 pb6f1 pb5f1 pb4f1 pb3f1 pb2f1 pb1f1 pb0f1 after reset11111000 bit bit symbol type function 31-8 ? r read as 0. 7pb7f1 r/w0 : port 1 : trst 6pb6f1 r/w0: port 1: tdi 5pb5f1 r/w0: port 1: tdo / swv 4pb4f1 r/w0: port 1: tck / swclk 3pb3f1 r/w0: port 1: tms / swdio 2pb2f1 r/w0: port 1: tracedata1 1pb1f1 r/w0: port 1: tracedata0 0pb0f1 r/w0: port 1: traceclk
page 8-14 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.2.6 pbod (port b open drain control register) 8.2.2.7 pbpup (port b pull-up control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pb7od pb6od pb5od pb4od pb3od pb2od pb1od pb0od after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7od to pb0od r/w 0 : cmos 1 : open-drain 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pb7up pb6up pb5up pb4up pb3up pb2up pb1up pb0up after reset11001000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7up to pb0up r/w pull-up 0: disable 1: enable
page 8-15 TMPM372FWUG 2013/4/15 8.2.2.8 pbpdn (port b pull-down control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pb7dn pb6dn pb5dn pb4dn pb3dn pb2dn pb1dn pb0dn after reset00010000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7dn to pbdn r/w pull-down 0: disable 1: enable
page 8-16 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.2.9 pbie (port b input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pb7ie pb6ie pb5ie pb4ie pb3ie pb2ie pb1ie pb0ie after reset11011000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pb7ie to pb0ie r/w input 0: disable 1: enable
page 8-17 TMPM372FWUG 2013/4/15 8.2.3 port d (pd4 to pd6) the port d is a general-purpose, 3-bit input / output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purp ose input / output functi on, the port d performs the serial interface func- tion (sio / uart), the 16-bit timer input/ output function and the encoder input function. reset initializes all bits of the port d as general- purpose ports with input, output, pull-up and pull-down dis- abled. the port d has two types of function register. if you us e the port d as a general-purpose port, set "0" to the corresponding bit of the two registers.if you use the port d as other than a general-purpose port, set "1" to the corresponding bit of the function register.do not set "1 " to the some function registers at the same time. 8.2.3.1 port d circuit type 8.2.3.2 port d register 76543210 type - t3 t2 t9 - - - base address = 0x4000_00c0 register name address(base+) port d data register pddata 0x0000 port d output control register pdcr 0x0004 port d function register 1 pdfr1 0x0008 port d function register 2 pdfr2 0x000c port d open drain control register pdod 0x0028 port d pull-up control register pdpup 0x002c port d pull-down control register pdpdn 0x0030 port d input control register pdie 0x0038
page 8-18 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.3.3 pddata (port d data register) 8.2.3.4 pdcr (port d output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-pd6pd5pd4---- after reset00000000 bit bit symbol type function 31-7 ? r read as 0. 6-4 pd6 to pd4 r/w port d data register 3-0 ? r/w write "0". 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-pd6cpd5cpd4c---- after reset00000000 bit bit symbol type function 31-7 ? r read as 0. 6-4 pd6c to pd4c r/w output 0: disable 1: enable 3-0 ? r/w write "0".
page 8-19 TMPM372FWUG 2013/4/15 8.2.3.5 pdfr1 (port d function register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-pd6f1pd5f1pd4f1---- after reset00000000 bit bit symbol type function 31-7 ? r read as 0. 6 pd6f1 r/w 0: port 1:rxd2 5 pd5f1 r/w 0: port 1: txd2 4 pd4f1 r/w 0: port 1: sclk2 3-0 ? r/w read as 0.
page 8-20 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.3.6 pdfr2 (port d function register 2) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------- after reset00000000 bit bit symbol type function 31-5 ? r read as 0. 4 ? r/w write "0". 3-0 ? r read as 0.
page 8-21 TMPM372FWUG 2013/4/15 8.2.3.7 pdod (port d open drain control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-pd6odpd5odpd4od---- after reset00000000 bit bit symbol type function 31-7 ? r read as 0. 6-4 pd6od to pd4od r/w 0 : cmos 1 : open-drain 3-0 ? r read as 0.
page 8-22 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.3.8 pdpup (port d pull-up control register) 8.2.3.9 pdpdn (port d pull-down control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-pd6uppd5uppd4up---- after reset00000000 bit bit symbol type function 31-7 ? r read as 0. 6-4 pd6up to pdup r/w pull-up 0: disable 1: enable 3-0 ? r read as 0. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-pd6dnpd5dnpd4dn---- after reset00000000 bit bit symbol type function 31-7 ? r read as 0. 6-4 pd6dn to pd4dn r/w pull-down 0: disable 1: enable 3-0 ? r read as 0.
page 8-23 TMPM372FWUG 2013/4/15 8.2.3.10 pdie (port d input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-pd6iepd5iepd4ie---- after reset00000000 bit bit symbol type function 31-7 ? r read as 0. 6-4 pd6ie to pd4ie r/w input 0: disable 1: enable 3-0 ? r read as 0.
page 8-24 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.4 port e (pe0 to pe7) the port e is a general-purpose, 8-bit input / output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose input / output function, the port e performs the serial interface func- tion (sio / uart), the external signal interrupt input and the 16-bit timer input/output function. reset initializes all bits of the port e as general-purpose ports with input, output, pull-up and pull-down dis- abled. the port e has two types of function register. if you use the port e as a general-purpose port, set "0" to the corresponding bit of the two registers.if you use the port e as other than a general-purpose port, set "1" to the corresponding bit of the function register.do not set "1 " to the some function registers at the same time. to use the external interrupt input for releasing stop mode, select th is function in the pefr2 and enable input in the peie register. these settings enable the interrupt input even if the cgstbycr bit in the clock / mode control block is set to stop driving of pins during stop mode. note:in modes other than stop mode, interrupt input is enabl ed regardless of the pxfr register setting if input is enabled in pxie. make sure to disable unused interrupts when programming the device. 8.2.4.1 port e circuit type 8.2.4.2 port e register 76543210 type t14 t12 t2 t12 t2 t9 t3 t2 base address = 0x4000_0100 register name address(base+) port e data register pedata 0x0000 port e output control register pecr 0x0004 port e function register 1 pefr1 0x0008 port e function register 2 pefr2 0x000c port e open drain control register peod 0x0028 port e pull-up control register pepup 0x002c port e pull-down control register pepdn 0x0030 port e input control register peie 0x0038
page 8-25 TMPM372FWUG 2013/4/15 8.2.4.3 pedata (port e data register) 8.2.4.4 pecr (port e output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pe7 pe6 pe2 pe1 pe0 after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pe7 to pe0 r/w port e data register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pe7c pe6c pe5c pe4c pe3c pe2c pe1c pe0c after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pe7c to pe0c r/w output 0: disable 1: enable
page 8-26 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.4.5 pefr1 (port e function register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pe7f1 pe6f1 pe5f1 pe4f1 pe3f1 pe2f1 pe1f1 pe0f1 after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7pe7f1 r/w0: port 1:tb3out 6pe6f1 r/w0: port 1:tb3in 5pe5f1 r/w0: port 1: tb2out 4pe4f1 r/w0: port 1: tb2in 3pe3f1 r/w0: port 1: tb4out 2pe2f1 r/w0: port 1: sclk0 1pe1f1 r/w0: port 1: rxd0 0pe0f1 r/w0: port 1: txd0
page 8-27 TMPM372FWUG 2013/4/15 8.2.4.6 pefr2 (port e function register 2) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pe7f2 pe6f2 - pe4f2 - pe2f2 - - after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7pe7f2 r/w0 : port 1 : int7 6pe6f2 r/w0: port 1: int6 5 ? r read as 0. 4pe4f2 r/w0: port 1: int5 3 ? r read as 0. 2pe2f2 r/w0: port 1: cts0 1-0 ? r read as 0.
page 8-28 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.4.7 peod (port e open drain control register) 8.2.4.8 pepup (port e pull-up control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pe7od pe6od pe5od pe4od pe3od pe2od pe1od pe0od after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pe7od to pe0od r/w 0 : cmos 1 : open-drain 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pe7up pe6up pe5up pe4up pe3up pe2up pe1up pe0up after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pe7up to pe0up r/w pull-up 0: disable 1: enable
page 8-29 TMPM372FWUG 2013/4/15 8.2.4.9 pepdn (port e pull-down control register) 8.2.4.10 peie (port e input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pe7dn pe6dn pe5dn pe4dn pe3dn pe2dn pe1dn pe0dn after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pe7dn to pe0dn r/w pull-down 0: disable 1: enable 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pe7ie pe6ie pe5ie pe4ie pe3ie pe2ie pe1ie pe0ie after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pe7ie to pe0ie r/w input 0: disable 1: enable
page 8-30 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.5 port f (pf0 to pf4) the port f is a general-purpose, 5-bit input / output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purp ose input / output function, the port f performs the serial interface func- tion (sio / uart), the 16-bit timer input/output function, the encoder input function and the operation mode setting. while a reset signal is in "0"state, the pf0 input and pull-up are enabled. at the rising edge of the reset sig- nal, if pf0 is "1", the device enters single mode and boots from the on-chip flash memory. if pf0 is "0", the device enters single boot mode and boots from the internal boot program. for details of single boot mode, refer to chapter "flash memory operation". reset initializes all bits of the port f as general-pur pose ports with input, output, pull-up and pull-down dis- abled. 8.2.5.1 port f circuit type 8.2.5.2 port f register 76543210 type ??? t11 t10 t15 t2 t20 base address = 0x4000_0140 register name address(base+) port f data register pfdata 0x0000 port f output control register pfcr 0x0004 port f function register 1 pffr1 0x0008 port f function register 2 pffr2 0x000c port f function register 3 pffr3 0x0010 port f open drain control register pfod 0x0028 port f pull-up control register pfpup 0x002c port f pull-down control register pfpdn 0x0030 port f input control register pfie 0x0038
page 8-31 TMPM372FWUG 2013/4/15 8.2.5.3 pfdata (port f data register) 8.2.5.4 pfcr (port f output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - pf4 pf3 pf2 pf1 pf0 after reset00000000 bit bit symbol type function 31-5 ? r read as 0. 4-0 pf4 to pf0 r/w port f data register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - pf4c pf3c pf2c pf1c pf0c after reset00000000 bit bit symbol type function 31-5 ? r read as 0. 4-0 pf4c to pf0c r/w output 0: disable 1: enable
page 8-32 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.5.5 pffr1 (port f function register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - pf4f1 pf3f1 pf2f1 pf1f1 pf0f1 after reset00000000 bit bit symbol type function 31-5 ? r read as 0. 4 pf4f1 r/w 0: port 1: encz1 3 pf3f1 r/w 0: port 1: encb1 2 pf2f1 r/w 0: port 1: enca1 1 pf1f1 r/w 0: port 1: tb7out 0 pf0f1 r/w 0: port 1: tb7in
page 8-33 TMPM372FWUG 2013/4/15 8.2.5.6 pffr2 (port f function register 2) 8.2.5.7 pffr3 (port f function register 3) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - pf4f2 pf3f2 pf2f2 - - after reset00000000 bit bit symbol type function 31-5 ? r read as 0. 4 pf4f2 r/w 0: port 1: rxd3 3 pf3f2 r/w 0: port 1: txd3 2 pf2f2 r/w 0: port 1: sclk3 1-0 ? r read as 0. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-----pf2f3-- after reset00000000 bit bit symbol type function 31-3 ? r read as 0. 2 pf2f3 r/w 0: port 1: cts3 1-0 ? r read as 0.
page 8-34 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.5.8 pfod (port f open drain control register) 8.2.5.9 pfpup (port f pull-up control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - pf4od pf3od pf2od pf1od pf0od after reset00000000 bit bit symbol type function 31-5 ? r read as 0. 4-0 pf4od to pf0od r/w 0 : cmos 1 : open-drain 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - pf4up pf3up pf2up pf1up pf0up after reset00000000 bit bit symbol type function 31-5 ? r read as 0. 4-0 pf4up to pf0up r/w pull-up 0: disable 1: enable
page 8-35 TMPM372FWUG 2013/4/15 8.2.5.10 pfpdn (port f pull-down control register) 8.2.5.11 pfie (port f input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - pf4dn pf3dn pf2dn pf1dn pf0dn after reset00000000 bit bit symbol type function 31-5 ? r read as 0. 4-0 pf4dn to pf0dn r/w pull-down 0: disable 1: enable 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - pf4ie pf3ie pf2ie pf1ie pf0ie after reset00000000 bit bit symbol type function 31-5 ? r read as 0. 4-0 pf4ie to pf0ie r/w input 0: disable 1: enable
page 8-36 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.6 port g (pg0 to pg7) the port g is a general-purpose, 8-bit input / output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose input / output function, the port g performs the input/output port for three-phase motor control (pmd) function. reset initializes all bits of the port g as general- purpose ports with input, output, pull-up and pull-down dis- abled. 8.2.6.1 port g circuit type 8.2.6.2 port g register 76543210 type t3 t3 t1 t1 t1 t1 t1 t1 base address = 0x4000_0180 register name address(base+) port g data register pgdata 0x0000 port g output control register pgcr 0x0004 port g function register 1 pgfr1 0x0008 port g open drain control register pgod 0x0028 port g pull-up control register pgpup 0x002c port g pull-down control register pgpdn 0x0030 port g input control register pgie 0x0038
page 8-37 TMPM372FWUG 2013/4/15 8.2.6.3 pgdata (port g data register) 8.2.6.4 pgcr (port g output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpg7pg6pg5pg4pg3pg2pg1pg0 after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7 to pg0 r/w port g data register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pg7c pg6c pg5c pg4c pg3c pg2c pg1c pg0c after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7c to pg0c r/w output 0: disable 1: enable
page 8-38 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.6.5 pgfr1 (port g function register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pg7f1 pg6f1 pg5f1 pg4f1 pg3f1 pg2f1 pg1f1 pg0f1 after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 pg7f1 r/w 0: port 1: ovv1 6 pg6f1 r/w 0: port 1: emg1 5 pg5f1 r/w 0: port 1: zo1 4 pg4f1 r/w 0: port 1: wo1 3 pg3f1 r/w 0: port 1: yo1 2 pg2f1 r/w 0: port 1: vo1 1 pg1f1 r/w 0: port 1: xo1 0 pg0f1 r/w 0: port 1: uo1
page 8-39 TMPM372FWUG 2013/4/15 8.2.6.6 pgod (port g open drain control register) 8.2.6.7 pgpup (port g pull-up control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pg7od pg6od pg5od pg4od pg3od pg2od pg1od pg0od after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7od to pg0od r/w 0 : cmos 1 : open-drain 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pg7up pg6up pg5up pg4up pg3up pg2up pg1up pg0up after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7up to pg0up r/w pull-up 0: disable 1: enable
page 8-40 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.6.8 pgpdn (port g pull-down control register) 8.2.6.9 pgie (port g input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pg7dn pg6dn pg5dn pg4dn pg3dn pg2dn pg1dn pg0dn after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7dn to pg0dn r/w pull-down 0: disable 1: enable 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pg7ie pg6ie pg5ie pg4ie pg3ie pg2ie pg1ie pg0ie after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pg7ie to pg0ie r/w input 0: disable 1: enable
page 8-41 TMPM372FWUG 2013/4/15 8.2.7 port i (pi3) the port i is a general-purpose, 1-bit input / output port. for this port, in puts and outputs can be specified in units of bits. besides the general-purpose input / output function, the port i performs the analog input of the ad converter. reset initializes all bits of the port i as general- purpose ports with input, output, pull-up and pull-down dis- abled. note:unless you use all the bits of port i as analog input pins, conversion accuracy may be reduced.be sure to ver- ify that this causes no problem on your system. 8.2.7.1 port i circuit type 8.2.7.2 port i register 76543210 type ???? t16 - - - base address = 0x4000_0200 register name address(base+) port i data register pidata 0x0000 port i output control register picr 0x0004 port i open drain control register piod 0x0028 port i pull-up control register pipup 0x002c port i pull-down control register pipdn 0x0030 port i input control register piie 0x0038
page 8-42 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.7.3 pidata (port i data register) 8.2.7.4 picr (port i output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol----pi3--- after reset00000000 bit bit symbol type function 31-4 ? r read as 0. 3 pi3 r/w port i data register 2-0 ? r/w read as 0. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol----pi3cpi2c-pi1c-pi0c- after reset00000000 bit bit symbol type function 31-4 ? r read as 0. 3 pi3c r/w output 0: disable 1: enable 2-0 ? r/w read as 0.
page 8-43 TMPM372FWUG 2013/4/15 8.2.7.5 piod (port i open drain control register) 8.2.7.6 pipup (port i pull-up control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol----pi3od--- after reset00000000 bit bit symbol type function 31-4 ? r read as 0. 3 pi3od r/w 0 : cmos 1 : open-drain 2-0 ? r/w read as 0. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol----pi3up--- after reset00000000 bit bit symbol type function 31-4 ? r read as 0. 3 pi3up r/w pull-up 0: disable 1: enable 2-0 ? r/w read as 0.
page 8-44 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.7.7 pipdn (port i pull-down control register) 8.2.7.8 piie (port i input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol----pi3dn--- after reset00000000 bit bit symbol type function 31-4 ? r read as 0. 3 pi3dn r/w pull-down 0: disable 1: enable 2-0 ? r/w read as 0. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol----pi3ie--- after reset00000000 bit bit symbol type function 31-4 ? r read as 0. 3 pi3ie r/w input 0: disable 1: enable 2-0 ? r/w read as 0.
page 8-45 TMPM372FWUG 2013/4/15 8.2.8 port j (pj0 to pj7) the port j is a general-purpose, 8-bit input / output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose input / output function, the port j perfor ms the analog input of the ad converterand the external signal interrupt input. reset initializes all bits of the port j as general- purpose ports with input, output, pull-up and pull-down dis- abled. to use the external interrupt input for releasing stop mode, select this function in the pjfr1 and enable input in the pjie register. these settings enable the interrupt input even if the cgstbycr bit in the clock / mode control block is set to stop driving of pins during stop mode. note 1: unless you use all the bits of port j as analog input pins, conversion accuracy may be reduced.be sure to verify that this causes no problem on your system. note 2: in modes other than stop mode, interrupt input is enabled regardless of the pxfr register setting if input is enabled in pxie. make sure to disabl e unused interrupts when programming the device. 8.2.8.1 port j circuit type 8.2.8.2 port j register 76543210 type t17 t17 t16 t16 t16 t16 t16 t16 base address = 0x4000_0240 register name address(base+) port j data register pjdata 0x0000 port j output control register pjcr 0x0004 port j function register 1 pjfr1 0x0008 port j open drain control register pjod 0x0028 port j pull-up control register pjpup 0x002c port j pull-down control register pjpdn 0x0030 port j input control register pjie 0x0038
page 8-46 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.8.3 pjdata (port j data register) 8.2.8.4 pjcr (port j output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pj7 pj6 pj5 pj4 pj3 pj2 pj1- pj0 after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7 to pj0 r/w port j data register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pj7c pj6c pj5c pj4c pj3c pj2c pj1c pj0c a f t e r r e s e t00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7c to pj0c r/w output 0: disable 1: enable
page 8-47 TMPM372FWUG 2013/4/15 8.2.8.5 pjfr1 (port j function register 1) 8.2.8.6 pjod (port j open drain control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpj7f1pj6f1------ after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7pj7f1 r/w0: port 1: intd 6pj6f1 r/w0: port 1: intc 5-0 ? r read as 0. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pj7od pj6od pj5od pj4od pj3od pj2od pj1od pj0od after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7od to pj0od r/w 0 : cmos 1 : open-drain
page 8-48 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.8.7 pjpup (port j pull-up control register) 8.2.8.8 pjpdn (port j pull-down control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pj7up pj6up pj5up pj4up pj3up pj2up pj1up pj0up after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7up to pj0up r/w pull-up 0: disable 1: enable 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pj7dn pj6dn pj5dn pj4dn pj3dn pj2dn pj1dn pj0dn after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7dn-pj0dn r/w pull-down 0: disable 1: enable
page 8-49 TMPM372FWUG 2013/4/15 8.2.8.9 pjie (port j input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol pj7ie pj6ie pj5ie pj4ie pj3ie pj2ie pj1ie pj0ie after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 pj7ie to pj0ie r/w input 0: disable 1: enable
page 8-50 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.9 port k (pk0 to pk1) the port k is a general-purpose, 2-bit input / output port. for this port, inputs and outputs can be specified in units of bits. besides the general-purpose input / output function, the port k performs the analog input of the ad converter and the external signal interrupt input. reset initializes all bits of the port k as general- purpose ports with input, output, pull-up and pull-down dis- abled. to use the external interrupt input for releasing stop mode, select this function in the pkfr1 and enable input in the pkie register. these settings enable the interrupt input even if the cgstbycr bit in the clock / mode control block is set to stop driving of pins during stop mode. note 1: unless you use all the bits of port k as analog input pins, conversion accura cy may be reduced.be sure to verify that this causes no problem on your system. note 2: in modes other than stop mode, interrupt input is enabled regardless of the pxfr register setting if input is enabled in pxie. make sure to disabl e unused interrupts when programming the device. 8.2.9.1 port k circuit type 8.2.9.2 port k register 76543210 t y p e ------t 1 7t 1 7 base address = 0x4000_0280 register name address(base+) port k data register pkdata 0x0000 port k output control register pkcr 0x0004 port k function register 1 pkfr1 0x0008 port k open drain control register pkod 0x0028 port k pull-up control register pkpup 0x002c port k pull-down control register pkpdn 0x0030 port k input control register pkie 0x0038
page 8-51 TMPM372FWUG 2013/4/15 8.2.9.3 pkdata (port k data register) 8.2.9.4 pkcr (port k output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pk1pk0 after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pk1 to pk0 r/w port k data register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - pk1c pk0c after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pk1c to pk0c r/w output 0: disable 1: enable
page 8-52 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.9.5 pkfr1 (port k function register 1) 8.2.9.6 pkod (port k open drain control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pk1f1pk0f1 after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1pk1f1 r/w0: port 1: intf 0pk0f1 r/w0: port 1: inte 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pk1odpk0od after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pk1od to pk0od r/w 0 : cmos 1 : open-drain
page 8-53 TMPM372FWUG 2013/4/15 8.2.9.7 pkpup (port k pull-up control register) 8.2.9.8 pkpdn (port k pull-down control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pk1uppk0up after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pk1up to pk0up r/w pull-up 0: disable 1: enable 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pk1dnpk0dn after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pk1dn- pk0dn r/w pull-down 0: disable 1: enable
page 8-54 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.9.9 pkie (port k input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pk1iepk0ie after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pk1ie-pk0ie r/w input 0: disable 1: enable
page 8-55 TMPM372FWUG 2013/4/15 8.2.10 port m (pm0 to pm1) the port m is a general-purpose, 2-bit input/output port . for this port, inputs and outputs can be specified in units of bits. besides the general-purpose input/o utput function, the port m performs the high-speed oscillator1(x1 and x2) by cgosccr=1. while it become cgosccr=1, each register of port m can not change to write. the procedure when it is used as an outside high-speed oscillator connection terminal look at a chapter of the "system clock".(note1) reset initializes all bits of the port m as general-purp ose ports with input, output, pull-up and pull-down dis- abled.(note2) note 1: if one of the port m registers except pmdata and pmod is not equal to the initial value, cgosccr can not be set to "1". note 2: the high-speed clock chosen after reset cancellation is a built-in high-s peed clock. therefore, in the initial state, it become port m. 8.2.10.1 port m circuit type 8.2.10.2 port m register 76543210 t y p e ------t 2 1t 2 1 base address = 0x4000_0300 register name address(base+) port m data register pmdata 0x0000 port m output control register pmcr 0x0004 port m open drain control register pmod 0x0028 port m pull-up control register pmpup 0x002c port m pull-down control register pmpdn 0x0030 port m input control register pmie 0x0038
page 8-56 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.10.3 pmdata (port m data register) 8.2.10.4 pmcr (port m output control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pm1pm0 after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pm1 to pm0 r/w port m data register 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pm1cpm0c after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pm1c to pm0c r/w output 0: disable 1: enable
page 8-57 TMPM372FWUG 2013/4/15 8.2.10.5 pmod (port m open drain control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pm1odpm0od after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pm1od to pm0od r/w 0 : cmos 1 : open-drain
page 8-58 8. input / output ports 8.2 port functions TMPM372FWUG 2013/4/15 8.2.10.6 pmpup (port m pull-up control register) 8.2.10.7 pmpdn (port m pull-down control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pm1uppm0up after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pm1up to pm0up r/w pull-up 0: disable 1: enable 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pm1dnpm0dn after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pm1dn to pm0dn r/w pull-down 0: disable 1: enable
page 8-59 TMPM372FWUG 2013/4/15 8.2.10.8 pmie (port m input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------pm1iepm0ie after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1-0 pm1ie to pm0ie r/w input 0: disable 1: enable
page 8-60 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3 block diagra ms of ports 8.3.1 port types the ports are classified as shown below. please refer to the following pages for the block diagrams of each port type. dot lines in the figure indicate the part of the equivale nt circuit described in the "block diagrams of ports". table 8-3 function lists type gp port function1 function2 function3 analog pull-up pull-dn program- mable open-drain note t1 i / o output ??? rr function output triggered by enable signal t2 i / o output ??? rr t3 i / o input ??? rr t4 i / o input (int) ??? rr t5 input input (int) ?????? t6 i / o i / o ??? nor ?? function output triggered by enable signal t7 i / o input ??? nor ?? t8 i / o input ???? nor ? t9 i / o i / o input ?? rr t10 i / o input output ?? rr t11 i / o input input ?? rr t12 i / o input input(int) ?? rr t13 i / o output output ?? rr t14 i / o output i / o ?? rr t15 i / o input i / o input ? rr t16 i / o ??? rr t17 i / o input(int) ?? rr t18 i / o output ??? r ?? t19 i / o output ??? nor ?? function output triggered by enable signal t20 i / o input ??? nor nor boot input enabled during reset t21 i / o - (osc1) ??? rr high-speed osscillator (external) int : interrupt input - : not exist o : exist r: forced disable during reset nor: unaffected by reset
page 8-61 TMPM372FWUG 2013/4/15 8.3.2 type t1 figure 8-1 port type t1 pxpup (pull-up control) i /o port port read 0 1 1 0 reset drive disable in stop mode (set by ) pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) function output 0 1 function output enable internal data bus programable pull-up and pull-down
page 8-62 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.3 type t2 figure 8-2 port type t2 pxpup (pull-up control) port read 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output controll) pxpdn (pull-down control) function output 0 1 internal data bus i /o port programable pull-up and pull-down drive disable in stop mode (set by )
page 8-63 TMPM372FWUG 2013/4/15 8.3.4 type t3 figure 8-3 port type t3 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output controll) pxpdn (pull-down control) port read i /o port programable pull-up and pull-down drive disable in stop mode (set by ) internal data bus function input1
page 8-64 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.5 type t4 figure 8-4 port type t4 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output controll) pxpdn (pull-down control) +pvgttwrv +prwv internal data bus port read i /o port drive disable in stop mode (set by ) programable pull-up and pull-down
page 8-65 TMPM372FWUG 2013/4/15 8.3.6 type t5 figure 8-5 port type t5 0 1 pxie (input control) pxfr1 (function control) ,qwhuuxsw ,qsxw i /o port drive disable in stop mode (set by ) internal data bus port read
page 8-66 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.7 type t6 figure 8-6 port type t6 pxpup (pull-up control) 0 1 1 0 pxie (input control) pxdata (output latch) pxfr1 (function control) pxcr (output controll) 0 1 1 0 (wpevkqp +prwv port read function output function output enable i /o port drive disable in stop mode (set by ) programable pull-up internal data bus
page 8-67 TMPM372FWUG 2013/4/15 8.3.8 type t7 figure 8-7 port type t7 pxpup (pull-up control) 0 1 pxie (input control) pxdata (output latch) pxfr1 (?(? ?) pxcr (output control) 1 0 reset (wpevkqp +prwv port read i /o port drive disable in stop mode (set by ) programable pull-up internal data bus
page 8-68 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.9 type t8 figure 8-8 port type t8 0 1 pxie (input control) pxdata (output latch) pxfr1 (?(? ?) pxcr (output control) 1 0 (wpevkqp +prwv reset pxpdn (pull-down control) internal data bus port read i /o port drive disable in stop mode (set by ) programable pull-down
page 8-69 TMPM372FWUG 2013/4/15 8.3.10 type t9 figure 8-9 port type t9 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) 0 1 (wpevkqp +prwv pxfr2 (function control (wpevkqp input2 i /o port drive disable in stop mode (set by ) programable pull-up and pull-down internal data bus function output port read
page 8-70 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.11 type t10 figure 8-10 port type t10 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) 0 1 (wpevkqp +prwv1 pxfr2 (function control) i /o port drive disable in stop mode (set by ) programable pull-up and pull-down internal data bus port read function output
page 8-71 TMPM372FWUG 2013/4/15 8.3.12 type t11 figure 8-11 port type t11 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) (wpevkqp +prwv1 pxfr2 (function control) (wpevkqp input2 internal data bus port read i /o port drive disable in stop mode (set by ) programable pull-up and pull-down
page 8-72 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.13 type t12 figure 8-12 port type t12 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) (wpevkqp input1 pxfr2 (function control) +pvgttwrv +prwv i /o port drive disable in stop mode (set by ) programable pull-up and pull-down port read internal data bus
page 8-73 TMPM372FWUG 2013/4/15 8.3.14 type t13 figure 8-13 port type t13 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) 0 1 pxfr2 (function control) 0 1 internal data bus function output1 function output2 port read i /o port drive disable in stop mode (set by ) programable pull-up and pull-down
page 8-74 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.15 type t14 figure 8-14 port type t14 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) pxfr2 (function control) +pvgttwrv +prwv 0 1 internal data bus function output port read i /o port drive disable in stop mode (set by ) programable pull-up and pull-down
page 8-75 TMPM372FWUG 2013/4/15 8.3.16 type t15 figure 8-15 port type t15 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain contro) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) 0 1 (wpevkqp+prwv1 pxfr2 (function control) pxfr3 (function control) (wpevkqp+prwv2 (wpevkqp+prwv3 i /o port drive disable in stop mode (set by ) programable pull-up and pull-down internal data bus function output2 port read
page 8-76 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.17 type t16 figure 8-16 port type t16 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxcr (output control) pxpdn (pull-down control) analog input internal data bus port read i /o port drive disable in stop mode (set by ) programable pull-up and pull-down
page 8-77 TMPM372FWUG 2013/4/15 8.3.18 type t17 figure 8-17 port type t17 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) interrupt input analog input i /o port drive disable in stop mode (set by ) programable pull-up and pull-down internal data bus port read
page 8-78 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.19 type t18 figure 8-18 port type t18 pxpup (pull-up control) 0 1 1 0 pxie (input control) pxdata (output latch) pxfr1 (function control) pxcr (output control) 0 1 reset port read internal data bus function output1 i /o port drive disable in stop mode (set by ) programable pull-up and pull-down
page 8-79 TMPM372FWUG 2013/4/15 8.3.20 type t19 figure 8-19 port type t19 pxpup (pull-up control) 1 0 pxie (input control) pxdata (output latch) pxfr1 (function control) pxcr (output control) 0 1 0 1 i /o port drive disable in stop mode (set by ) programable pull-up and pull-down port read internal data bus function output function output enable
page 8-80 8. input / output ports 8.3 block diagrams of ports TMPM372FWUG 2013/4/15 8.3.21 type t20 pxpup (pull-up control) 0 1 reset pxie (input control)) pxod (open drain control) pxdata (output latch) pxfr1 (function control) pxcr (output control) pxpdn (pull-down control) (wpevkqp +prwv1 boot port read internal data bus i /o port drive disable in stop mode (set by ) programable pull-up and pull-down
page 8-81 TMPM372FWUG 2013/4/15 8.3.22 type t21 pxpup (pull-up control) 0 1 reset pxie (input control) pxod (open drain control) pxdata (output latch) pxcr (output control) pxpdn (pull-down control) external high-speed oscillator port read internal data bus i /o port drive disable in stop mode (set by ) programable pull-up and pull-down
page 8-82 8. input / output ports 8.4 appendix port setting list TMPM372FWUG 2013/4/15 8.4 appendix port setting list the following table shows the re gister setting for each function. initialization of the ports where the [ ? ]does not exist in the "after reset" field is set to "0" for all register settings. setting for the bit "x" can be arbitrarily-specified. 8.4.1 port a setting table 8-4 port setting list(port a) pin port type function after reset pacr pafr1 pafr2 paod papup papdn paie pa0 t12 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 tb0in (input) 0 1 0 x x x 1 int7 (input) 0 0 1 x x x 1 pa1 t2 input port 0 0 - x x x 1 output port 1 0 - x x x 0 tb0out(output) 1 1 - x x x 0 pa2 t12 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 tb1in (input) 0 1 0 x x x 1 int4 (input) 0 0 1 x x x 1 pa3 t2 input port 0 0 - x x x 1 output port 1 0 - x x x 0 tb1out(output) 1 1 - x x x 0 pa4 t9 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 sclk1 (i / o) 110xxx1 cts1 (input) 0 0 1 x x x 1 pa5 t13 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 txd1 (output) 1 1 0 x x x 0 tb6out(output) 1 0 1 x x x 0 pa6 t11 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 rxd1 (input) 0 1 0 x x x 1 tb6in (input) 0 0 1 x x x 1 pa7 t12 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 tb4in (input) 0 1 0 x x x 1 int8 (input) 0 0 1 x x x 1
page 8-83 TMPM372FWUG 2013/4/15 8.4.2 port b setting table 8-5 port setting list(port b) pin port type function after reset pbcr pbfr1 pbod pbpup pbpdn pbie pb0 t18 input port 0 0 x x x 1 output port 10xxx0 traceclk (output) 110000 pb1 t18 input port 0 0 x x x 1 output port 10xxx0 tracedata0 (output) 110000 pb2 t18 input port 0 0 x x x 1 output port 10xxx0 tracedata1 (output) 110000 pb3 t6 input port 0 0 x x x 1 output port 10xxx0 tms / swdio (i / o) 110101 pb4 t8 input port 0 0 x x x 1 output port 10xxx0 tck / swclk (input) 010011 pb5 t19 input port 0 0 x x x 1 output port 10xxx0 tdo / swv (output) 110000 pb6 t7 input port 0 0 x x x 1 output port 10xxx0 tdi (input) 010101 pb7 t7 input port 0 0 x x x 1 output port 10xxx0 trst (input) 0 1 0111
page 8-84 8. input / output ports 8.4 appendix port setting list TMPM372FWUG 2013/4/15 8.4.3 port d setting table 8-6 port setting list(port d) pin port type function after reset pdcr pdfr1 pdfr2 pdod pdpup pdpdn pdie pd4 t9 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 sclk2 (i / o) 110xxx1 cts2 (input) 0 0 1 x x x 1 pd5 t2 input port 0 0 - x x x 1 output port 1 0 - x x x 0 txd2 (output) 1 1 - x x x 0 pd6 t3 input port 0 0 - x x x 1 output port 1 0 - x x x 0 rxd2 (input) 0 1 - x x x 1
page 8-85 TMPM372FWUG 2013/4/15 8.4.4 port e setting table 8-7 port setting list(port e) pin port type function after reset pecr pefr1 pefr2 peod pepup pepdn peie pe0 t2 input port 0 0 - x x x 1 output port 1 0 - x x x 0 txd0 (output) 1 1 - x x x 0 pe1 t3 input port 0 0 - x x x 1 output port 1 0 - x x x 0 rxd0 (input) 0 1 - x x x 1 pe2 t9 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 sclk0 (i / o) 110xxx1 cts0 (input) 0 0 1 x x x 1 pe3 t2 input port 0 0 - x x x 1 output port 1 0 - x x x 0 tb4out (output) 1 1 - x x x 0 pe4 t12 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 tb2in (input) 0 1 0 x x x 1 int5 (input) 0 0 1 x x x 1 pe5 t2 input port 0 0 - x x x 1 output port 1 0 - x x x 0 tb2out (output) 1 1 - x x x 0 pe6 t12 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 tb3in (input) 0 1 0 x x x 1 int6 (input) 0 0 1 x x x 1 pe7 t14 input port 0 0 0 x x x 1 output port 1 0 0 x x x 0 tb3out (output) 1 1 0 x x x 0 int7 (input) 0 0 1 x x x 1
page 8-86 8. input / output ports 8.4 appendix port setting list TMPM372FWUG 2013/4/15 8.4.5 port f setting note:the pf0 input and pull-up are enabled and act as boot input pin while a reset is in "low" state table 8-8 port setting list(port f) pin port type function after reset pfcr pffr1 pffr2 pffr3 pfod pfpup pfpdn pfie pf0 t20 input port 0 0 - - x x x 1 output port 1 0 - - x x x 0 tb7in (input) 0 1 - - x x x 1 pf1 t2 input port 0 0 - - x x x 1 output port 1 0 - - x x x 0 tb7out (output) 1 1 - - x x x 0 pf2 t15 input port 0 0 0 0 x x x 1 output port 1 0 0 0 x x x 0 enca1 (input) 0 1 0 0 x x x 1 sclk3 (i / o) 1 0 1 0 x x x 1 cts3 (input) 0 0 0 1 x x x 1 pf3 t10 input port 0 0 0 - x x x 1 output port 1 0 0 - x x x 0 encb1 (input) 0 1 0 - x x x 1 txd3 (output) 1 0 1 - x x x 0 pf4 t11 input port 0 0 0 - x x x 1 output port 1 0 0 - x x x 0 encz1 (input) 0 1 0 - x x x 1 rxd3 (input) 0 0 1 - x x x 1
page 8-87 TMPM372FWUG 2013/4/15 8.4.6 port g setting 8.4.7 port i setting table 8-9 port setting list(port g) pin port type function after reset pgcr pgfr1 pgod pgpup pgpdn pgie pg0 t1 input port 0 0 x x x 1 output port 10xxx0 uo1 (output) 1 1 x x x 0 pg1 t1 input port 0 0 x x x 1 output port 10xxx0 xo1 (output) 1 1 x x x 0 pg2 t1 input port 0 0 x x x 1 output port 10xxx0 vo1 (output) 1 1 x x x 0 pg3 t1 input port 0 0 x x x 1 output port 10xxx0 yo1 (output) 1 1 x x x 0 pg4 t1 input port 0 0 x x x 1 output port 10xxx0 wo1 (output) 1 1 x x x 0 pg5 t1 input port 0 0 x x x 1 output port 10xxx0 zo1 (output) 1 1 x x x 0 pg6 t3 input port 0 0 x x x 1 output port 10xxx0 emg1 (input) 0 1 x x x 1 pg7 t3 input port 0 0 x x x 1 output port 10xxx0 ovv1 (input) 0 1 x x x 1 table 8-10 port setting list(port i) pin port type function after reset picr piod pipup pipdn piie pi3 t16 input port 0xxx1 output port 1 x x x 0 analog input 00000
page 8-88 8. input / output ports 8.4 appendix port setting list TMPM372FWUG 2013/4/15 8.4.8 port j setting table 8-11 port setting list(port j) pin port type function after reset pjcr pjfr1 pjod pjpup pjpdn pjie pj0 t16 input port 0 - x x x 1 output port 1 - x x x 0 analog input 0 - 0000 pj1 t16 input port 0 - x x x 1 output port 1 - x x x 0 analog input 0 - 0000 pj2 t16 input port 0 - x x x 1 output port 1 - x x x 0 analog input 0 - 0000 pj3 t16 input port 0 - x x x 1 output port 1 - x x x 0 analog input 0 - 0000 pj4 t16 input port 0 - x x x 1 output port 1 - x x x 0 analog input 0 - 0000 pj5 t16 input port 0 - x x x 1 output port 1 - x x x 0 analog input 0 - 0000 pj6 t17 input port 0 0 x x x 1 output port 1 0 x x x 0 analog input 000000 intc (input) 0 1 x x x 1 pj7 t17 input port 0 0 x x x 1 output port 1 0 x x x 0 analog input 000000 intd (input) 0 1 x x x 1
page 8-89 TMPM372FWUG 2013/4/15 8.4.9 port k setting 8.4.10 port m setting note:x1,x2 exist table 8-12 port setting list(port k) pin port type function after reset pkcr pkfr1 pkod pkpup pkpdn pkie pk0 t17 input port 0 0 x x x 1 output port 10xxx0 analog input 0 0 0000 inte (input) 0 1 x x x 1 pk1 t17 input port 0 0 x x x 1 output port 10xxx0 analog input 0 0 0000 intf (input) 0 1 x x x 1 table 8-13 port setting list(port m) pin port type function after reset pmcr pmod pmpup pmpdn pmie pm0 t21 input port 0xxx1 output port 1 x x x 0 pm1 t21 input port 0xxx1 output port 1 x x x 0
page 8-90 8. input / output ports 8.4 appendix port setting list TMPM372FWUG 2013/4/15
page 9-1 TMPM372FWUG 2013/4/15 9. 16-bit timer / event counters (tmrb) 9.1 outline tmrb operate in the following four operation modes: ? 16-bit interval timer mode ? 16-bit event counter mode ? 16-bit programmable pulse generation mode (ppg) ? external trigger programmable pulse generation mode (ppg) the use of the capture function allows tmrb to perform the following two measurements. ? one shot pulse output by an external trigger ? pulse width measurement in the following explanation of this s ection, "x" indicates a channel number.
page 9-2 9. 16-bit timer / event counters (tmrb) 9.2 differences in the specifications TMPM372FWUG 2013/4/15 9.2 differences in the specifications TMPM372FWUG contains 8-channel of tmrb. each channel functions independently and the channels oper ate in the same way except for the differences in their specification as shown in table 9-1. table 9-1 differences in the specifications of tmrb modules specification external pins interrupt internal connection channel external clock / capture trigger input pins timer flip-flop output pin capture interrupt tmrb interrupt adc conversion start timer flip-flop output tbxout from sio/uart (txtrg: transfer clock) signal name signal name tmrb0 tb0in tb0out intcap00 intcap01 inttb00 inttb01 tmrb1 tb1in tb1out intcap10 intcap11 inttb10 inttb11 tmrb2 tb2in tb2out intcap20 intcap21 inttb20 inttb21 tmrb3 tb3in tb3out intcap30 intcap31 inttb30 inttb31 tmrb4 tb4in tb4out intcap40 intcap41 inttb40 inttb41 sio0,sio1 tmrb5 - - intcap50 - inttb50 inttb51 inttb51 tmrb6 tb6in tb6out intcap60 intcap61 inttb60 inttb61 tmrb7 tb7in tb7out intcap70 intcap71 inttb70 inttb71 sio2,sio3
page 9-3 TMPM372FWUG 2013/4/15 9.3 configuration each channel consists of a 16-bit up-counter, two 16-bit timer registers (double-buffe red), two 16-bit capture reg- isters, two comparators, a capt ure input control, a timer flip-flop and its associated control circuit. timer operation modes and the timer flip-flop ar e controlled by a register. figure 9-1 tmrbx blo ck diagram (x= 0 to 7) 2 4 8 16 32 t1 t4 t16 t1 t4 t16 tmrbx interrupt inttbx1 inttbx0 tbxin internal data bus run/ clear tbxmod tbxcr tbxmod tbxmod tbxmod prescaler clock: t0 timer flip-flop timer flip-flop output tbxout register buffer0 internal data bus count clock tbxff0 m+ capture control register buffer1 match detect timer flip-flop control capture interrupt intcapx1 tbxcr interrupt mask register tbxim capture interrupt intcapx0 comparator (cp0) comparator (cp1) 16-bit up-counter (uc) capture register1 tbxcp1 capture register0 tbxcp0 up-counter capture register tbxuc prescaler / up-counter control tbxrun tbxcr run/clear status register tbxst timer register0 tbxrg0 timer register1 tbxrg1 register 1 interrupt output register 0 interrupt output overflow interrupt output register 1 interrupt mask register 0 interrupt mask overflow interrupt mask
page 9-4 9. 16-bit timer / event counters (tmrb) 9.4 registers TMPM372FWUG 2013/4/15 9.4 registers 9.4.1 register list according to channel the following table shows the register names and addresses of each channel. channel x base address channel0 0x4001_0000 channel1 0x4001_0040 channel2 0x4001_0080 channel3 0x4001_00c0 channel4 0x4001_0100 channel5 0x4001_0140 channel6 0x4001_0180 channel7 0x4001_01c0 register name (x=0 to 7) address (base+) enable register tbxen 0x0000 run register tbxrun 0x0004 control register tbxcr 0x0008 mode register tbxmod 0x000c flip-flop control register tbxffcr 0x0010 status register tbxst 0x0014 interrupt mask register tbxim 0x0018 up counter capture register tbxuc 0x001c timer register 0 tbxrg0 0x0020 timer register 1 tbxrg1 0x0024 capture register 0 tbxcp0 0x0028 capture register 1 tbxcp1 0x002c
page 9-5 TMPM372FWUG 2013/4/15 9.4.2 tbxen(enable register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symboltbentbhalt------ after reset00000000 bit bit symbol type function 31-8 ? r read as "0". 7 tben r/w tmrbx operation 0: disable 1: enable specifies the tmrb operation. when the operation is disabled, no clock is supplied to the other registers in the tmrb module. this can reduce power c onsumption. (this disables reading from and writing to the other reg- isters except tbxen register.) to use the tmrb, enable the tmrb operation (set to "1") before programming each register in the tmrb mod- ule. if the tmrb operation is executed and then disabled, the settings will be maintained in each register. 6 tbhalt r/w clock operation during debug halt. 0: run 1: stop 5-0 ? r read as "0".
page 9-6 9. 16-bit timer / event counters (tmrb) 9.4 registers TMPM372FWUG 2013/4/15 9.4.3 tbxrun(run register) note 1: when the external trigger start is used (=1), select and before the setting of ==1. note 2: when the counter is stopped (="0") and tbxu c is read, the value which was cap- tured when the counter was operated is read. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-----tbprun-tbrun after reset00000000 bit bit symbol type function 31-3 ? r read as "0". 2 tbprun r/w prescaler operation 0: stop & clear 1: count 1 ? r read as "0". 0 tbrun r/w count operation 0: stop & clear 1: count
page 9-7 TMPM372FWUG 2013/4/15 9.4.4 tbxcr(control register) note 1: do not modify tbxcr during operating tmrb. note 2: when the external trigger start is used (< cssel>=1), select and before the setting of ==1. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol tbwbf - - - i2tb - trgsel cssel after reset00000000 bit bit symbol type function 31-8 ? r read as "0". 7 tbwbf r/w double buffer 0: disable 1: enable 6-5 ? r/w write as "0". 4 ? r read as "0". 3 i2tb r/w operation at idle mode 0: stop 1: operation 2 ? r read as "0". 1 trgsel r/w external trigger select 0: rising edge 1: falling edge 0 cssel r/w counter start select 0: software start 1: external trigger
page 9-8 9. 16-bit timer / event counters (tmrb) 9.4 registers TMPM372FWUG 2013/4/15 9.4.5 tbxmod(mode register) note:do not change tbxmod register while the timer is operating. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - tbrswr tbcp tbcpm tbcle tbclk after reset00100000 bit bit symbol type function 31-7 ? r read as "0". 6 tbrswr r/w writes to timer registers 0 and 1 (when double buffering is enabled) 0: the data transfer to the timer register 0 and 1 is done by corresponding to the up-counter (uc) regardless of the rewriting of the buffer register 0 and 1. 1: to transfer the buffer registers data to the timer registers, the writing of the timer register 0 and 1 together are needed. 5tbcp w capture control by software 0: capture by software 1: don?t care when "0" is written, the capture register 0 (tbxcp0) takes count value. read as "1". 4-3 tbcpm[1:0] r/w capture timing 00: disable capture timing 01: tbxin takes count values into capture register 0 (tbxcp0) upon rising of tbxin pin input. 10: tbxin tbxin takes count values into capture register 0 (tbxcp0) upon rising of tbxin pin input. takes count values into capture register 1 (tbxcp1) upon falling of tbxin pin input. 11: disable capture timing 2 tbcle r/w up-counter control 0: disables clearing of the up-counter 1: enables clearing of the up-counter. clears and controls the up-counter. when "0" is written, it disables clearing of the up-counter. when "1" is written, it clears up counter when there is a match with timer regsiter1 (tbxrg1). 1-0 tbclk[1:0] r/w selects the tmrbx source clock. 00: tbxin pin input 01: t1 10: t4 11: t16
page 9-9 TMPM372FWUG 2013/4/15 9.4.6 tbxffcr(flip-fl op control register) note:do not change tbxffcr register while the timer is operating. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - tbc1t1 tbc0t1 tbe1t1 tbe0t1 tbff0c after reset11000011 bit bit symbol type function 31-8 ? r read as "0". 7-6 ? r read as "1". 5 tbc1t1 r/w tbxff0 reverse trigger when the up-counter value is taken into the tbxcp1. 0: disable trigger 1: enable trigger by setting "1", the timer-flip-flop reverses when the up-counter value is taken into the capture register 1 (tbxcp1). 4 tbc0t1 r/w tbxff0 reverse trigger when the up-counter value is taken into the tbxcp0. 0: disable trigger 1: enable trigger by setting "1", the timer-flip-flop reverses when the up-counter value is taken into the capture register 0 (tbxcp0). 3 tbe1t1 r/w tbxff0 reverse trigger when the up-counter value is matched with tbxrg1. 0: disable trigger 1: enable trigger by setting "1", the timer-flip-flop reverses when the up-counter value is matched with the timer register 1 (tbxrg1). 2 tbe0t1 r/w tbxff0 reverse trigger when t he up-counter value is matched with tbxrg0. 0: disable trigger 1: enable trigger by setting "1", the timer-flip-flop reverses when an up-counter value is matched with the timer register 0 (tbxrg0). 1-0 tbff0c[1:0] r/w tbxff0 control 00: invert reverses the value of tbxff0 (reverse by using software). 01: set sets tbxff0 to "1". 10: clear clears tbxff0 to "0". 11: don't care * this is always read as "11".
page 9-10 9. 16-bit timer / event counters (tmrb) 9.4 registers TMPM372FWUG 2013/4/15 9.4.7 tbxst(status register) note 1: the factors only which is not masked by tbxim out put interrupt request to the cpu.even if the mask setting is done, the flag is set. note 2: the flag is cleared by reading the tbxst register.to clear the flag, tbxst register should be read. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-----inttbofinttb1inttb0 after reset00000000 bit bit symbol type function 31-3 ? r read as "0". 2 inttbof r overflow flag 0: no overflow occurs 1: overflow occurs when an up-counter is overflow, "1" is set. 1 inttb1 r match flag (tbxrg1) 0: no match is detected 1: detects a match with tbxrg1 when a match with the timer register 1 (tbxrg1) is detected,"1" is set. 0 inttb0 r match flag (tbxrg0) 0: no match is detected 1: detects a match with tbxrg0 when a match with the timer register 0 (tbxrg0) is detected, "1" is set.
page 9-11 TMPM372FWUG 2013/4/15 9.4.8 tbxim(interr upt mask register) note:even if mask configuration by tbxim register is valid, the status is set to tbxst register. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-----tbimoftbim1tbim0 after reset00000000 bit bit symbol type function 31-3 ? r read as "0". 2 tbimof r/w overflow interrupt mask 0: disable 1: enable sets the up-counter overflow interrupt to disable or enable. 1 tbim1 r/w match interrupt mask (tbxrg1) 0: disable 1: enable sets the match interrupt mask with the timer register 1 (tbxrg1) to enable or disable. 0 tbim0 r/w match interrupt mask (tbxrg0) 0: disable 1: enable sets the match interrupt mask with the timer register 0 (tbxrg0) to enable or disable.
page 9-12 9. 16-bit timer / event counters (tmrb) 9.4 registers TMPM372FWUG 2013/4/15 9.4.9 tbxuc(up counter capture register) note:when the counter is operated and tbxuc is read, the value of the up counter is captured and read. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol tbuc after reset00000000 7 6 5 4 3 2 1 0 bit symbol tbuc after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 tbuc[15:0] r captures a value by reading up-counter out. if tbxuc is read, current up-counter value can be captured.
page 9-13 TMPM372FWUG 2013/4/15 9.4.10 tbxrg0(timer register 0) 9.4.11 tbxrg1(timer register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol tbrg0 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tbrg0 after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 tbrg0[15:0] r/w sets a value comparing to the up-counter. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol tbrg1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tbrg1 after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 tbrg1[15:0] r/w sets a value comparing to the up-counter.
page 9-14 9. 16-bit timer / event counters (tmrb) 9.4 registers TMPM372FWUG 2013/4/15 9.4.12 tbxcp0(capture register 0) 9.4.13 tbxcp1(capture register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol tbcp0 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tbcp0 after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 tbcp0[15:0] r a value captured from the up-counter is read. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol tbcp1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tbcp1 after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 tbcp1[15:0] r a value captured from the up-counter is read.
page 9-15 TMPM372FWUG 2013/4/15 9.5 description of operations for each circuit the channels operate in the same way, except for the di fferences in their specificati ons as shown in table 9-1. 9.5.1 prescaler there is a 4-bit prescaler to generate the source clock for up-counter uc. the prescaler input clock t0 is fperiph/1, fperiph/2, fperiph/4, fp eriph/8, fperiph/16 or fperiph/32 selected by cgsyscr in the cg. the peripheral cloc k, fperiph, is either fgear, a clock selected by cgsyscr in the cg, or fc, which is a clock before it is divided by the clock gear. the operation or the stoppage of a prescaler is set with tbxrun where writing "1" starts count- ing and writing "0" clears and stops counting. tabl e 9-2 show prescaler output clock resolutions.
page 9-16 9. 16-bit timer / event counters (tmrb) 9.5 description of operations for each circuit TMPM372FWUG 2013/4/15 table 9-2 prescaler output clock resolutions (fc = 80mhz) select peripheral clock cgsyscr clock gear value cgsyscr select prescaler clock cgsyscr prescaler output clock function t1 t4 t16 0 (fgear) 000 (fc) 000 (fperiph/1) fc/2 1 (0.025 s) fc/2 3 (0.1 s) fc/2 5 (0.4 s) 001 (fperiph/2) fc/2 2 (0.05 s) fc/2 4 (0.2 s) fc/2 6 (0.8 s) 010 (fperiph/4) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 100 (fc/2) 000 (fperiph/1) fc/2 2 (0.05 s) fc/2 4 (0.2 s) fc/2 6 (0.8 s) 001 (fperiph/2) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 010 (fperiph/4) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 011 (fperiph/8) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 100 (fperiph/16) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 101 (fperiph/32) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 101 (fc/4) 000 (fperiph/1) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 001 (fperiph/2) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 010 (fperiph/4) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 011 (fperiph/8) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 100 (fperiph/16) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 101 (fperiph/32) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 110 (fc/8) 000 (fperiph/1) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 001 (fperiph/2) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 010 (fperiph/4) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 011 (fperiph/8) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 100 (fperiph/16) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 101 (fperiph/32) fc/2 9 (6.4 s) fc/2 11 (25.6 s) fc/2 13 (102.4 s) 111 (fc/16) 000 (fperiph/1) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 001 (fperiph/2) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 010 (fperiph/4) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 011 (fperiph/8) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 100 (fperiph/16) fc/2 9 (6.4 s) fc/2 11 (25.6 s) fc/2 13 (102.4 s) 101 (fperiph/32) fc/2 10 (12.8 s) fc/2 12 (51.2 s) fc/2 14 (204.8 s)
page 9-17 TMPM372FWUG 2013/4/15 note 1: the prescaler output clock tn must be selected so that tn < fsys is satisfied (so that tn is slower than fsys). note 2: do not change the clock gear while the timer is operating. note 3: " ? " denotes a setting prohibited. 1 (fc) 000 (fc) 000 (fperiph/1) fc/2 1 (0.025 s) fc/2 3 (0.1 s) fc/2 5 (0.4 s) 001 (fperiph/2) fc/2 2 (0.05 s) fc/2 4 (0.2 s) fc/2 6 (0.8 s) 010 (fperiph/4) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 100 (fc/2) 000 (fperiph/1) ? fc/2 3 (0.1 s) fc/2 5 (0.4 s) 001 (fperiph/2) fc/2 2 (0.05 s) fc/2 4 (0.2 s) fc/2 6 (0.8 s) 010 (fperiph/4) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 101 (fc/4) 000 (fperiph/1) ? fc/2 3 (0.1 s) fc/2 5 (0.4 s) 001 (fperiph/2) ? fc/2 4 (0.2 s) fc/2 6 (0.8 s) 010 (fperiph/4) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 110 (fc/8) 000 (fperiph/1) ? ? fc/2 5 (0.4 s) 001 (fperiph/2) ? fc/2 4 (0.2 s) fc/2 6 (0.8 s) 010 (fperiph/4) ? fc/2 5 (0.4 s) fc/2 7 (1.6 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 111 (fc/16) 000 (fperiph/1) ? ? fc/2 5 (0.4 s) 001 (fperiph/2) ? ? fc/2 6 (0.8 s) 010 (fperiph/4) ? fc/2 5 (0.4 s) fc/2 7 (1.6 s) 011 (fperiph/8) ? fc/2 6 (0.8 s) fc/2 8 (3.2 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) table 9-2 prescaler output clock resolutions (fc = 80mhz) select peripheral clock cgsyscr clock gear value cgsyscr select prescaler clock cgsyscr prescaler output clock function t1 t4 t16
page 9-18 9. 16-bit timer / event counters (tmrb) 9.5 description of operations for each circuit TMPM372FWUG 2013/4/15 9.5.2 up-counter (uc) uc is a 16-bit binary counter. ? source clock uc source clock, specified by tbxmod, can be selected fr om either three types t1, t4, t16 of prescaler output clock or th e external clock of the tbxin pin. ? count start / stop counter operation is specified by tbxrun< tbrun>. uc starts counting if = "1", and stops counting and clears counter value if = "0". ? timing to clear uc 1. when a match is detected by setting tbxmod = "1", uc is cleared if when the comparator detects a match between counter value and the value set in tbxr g1. uc operates as a free-running counter if tbxmod = "0". 2. when uc stops uc stops counting and clears counter value if tbxrun = "0". ? uc overflow if uc overflow occurs, the inttbx0 overflow interrupt is generated. 9.5.3 timer register s (tbxrg0, tbxrg1) tbxrg0 and tbxrg1 are registers for setting values to compare with up-counter values and two registers are built into each channel. if the comp arator detects a match between a value set in this timer register and that in a uc up-counter, it outputs the match detection signal. tbxrg0 and tbxrg1 are consisted of the double-buffe red configuration which are paired with register buffers. the double buffering is disabled in the initial state. controlling double buffering disable or enable is specified by tbxcr bit. if = "0", the double buffering becomes disable. if = "1", it becomes enable. when the double buffering is enabled, a data transfer from the regi ster buffer to the timer register (tbxrg0/1) is done in the case that uc is matched with tbxrg1. when the counter is stopped even if double buffering is enabled, the double buffering operates as a single buffer, and an immediate da ta can be written to the tbxrg0 and tbxrg1. 9.5.4 capture this is a circuit that controls the timing of latching values from the uc up-counter into the tbxcp0 and tbxcp1 capture registers. the timing with which to latch data is specified by tbxmod. software can also be used to import values from th e uc up-counter into the captu re register; specifically, uc values are taken into the tbxcp0 capture regi ster each time "0" is written to tbxmod.
page 9-19 TMPM372FWUG 2013/4/15 9.5.5 capture register (tbxcp0, tbxcp1) this register captures an up-counter (uc) value. 9.5.6 up counter capture register (tbxuc) other than the capturing functions shown above, the current count value of the uc can be captured by read- ing the tbxuc registers. 9.5.7 comparators (cp0, cp1) this register compares with the up-counter (uc) and the value setting of the timer register (tbxrg0 and tbxrg1) to detect whether there is a match or not. if a match is detected, inttbx0 and inttbx1 are gener- ated. 9.5.8 timer flip-flop (tbxff0) the timer flip-flop (tbxff0) is reversed by a match sign al from the comparator and a latch signal to the cap- ture registers. it can be enabled or disabled to reverse by setting the tbxffcr. the value of tbxff0 becomes undefi ned after a reset. the flip-flop can be reversed by writing "00" to tbxffcr. it can be set to "1" by writing "01," and can be cleared to "0" by writing "10." the value of tbxff0 can be output to the timer output pin (tbxout). if the timer output is performed, the corresponding port settings must be programmed beforehand. 9.5.9 capture interrupt (intcapx0, intcapx1) interrupts intcapx0 and intcapx1 can be generated at the timing of latching values from the uc up- counter into the tbxcp0 and tbxcp1 capture registers. the interrupt timing is specified by the cpu.
page 9-20 9. 16-bit timer / event counters (tmrb) 9.6 description of operations for each mode TMPM372FWUG 2013/4/15 9.6 description of operations for each mode 9.6.1 16-bit interval timer mode in the case of generating constant period interrupt, se t the interval time to the timer register (tbxrg0) to generate the inttbx0 interrupt. same as tbxrg0, inttbx 1 interrupt is generated by setting different inter- val time value to tbxrg1 timer resister. note:x; don?t care ? ; no change 9.6.2 16-bit ev ent counter mode it is possible to make it the event counter by using an input clock as an extern al clock (tbxin pin input). the up-counter counts up on the rising edge of tbxin pin input. it is possible to read the count value by cap- turing value using software and reading the captured value. note:x; don?t care ? ; no change 76543210 tbxen 1 x x x x x x x enables tmrbx operation. tbxrun x x x x x 0 x 0 stops count operation. interrupt set-enable register * * * * * * * * permits inttbx1 interrupt by setting corresponding bit to "1". tbxffcr xx000011 disable to tbxff0 reverse trigger. tbxmod x 0 1 0 0 1 * * changes to prescaler output clock as input clock. specifies capture function to disable. (** = 01, 10, 11) tbxrg1 * * * * * * * * specifies a time interval. (16 bits) ******** tbxrun *****1x1 starts tmrbx. 76543210 tbxen 1 x x x x x x x enables tmrbx operation. tbxrun x x x x x 0 x 0 stops count operation. set port registers. allocates corresponding port to tbxin. tbxffcr xx000011 disable to tbxff0 reverse trigger. tbxmod x 0 1 0 0 0 0 0 changes to tbxin as an input clock. tbxrun *****1x1 starts tmrbx. tbxmod x 0 0 0 0 0 0 0 software capture is done.
page 9-21 TMPM372FWUG 2013/4/15 9.6.3 16-bit ppg (programmable pulse generation) output mode square waves with any frequency and any duty (pro grammable square waves) can be output. the output pulse can be either lo w-active or high-active. programmable square waves can be output from the tbxout pin by triggering the timer flip-flop (tbxff) to reverse when the set value of the up-counter (uc) matches the set values of the timer registers (tbxrg0 and tbxrg1). note that the set values of tbxrg0 and tbxrg1 must satisfy the following requirement: set value of tbxrg0 < set value of tbxrg1 figure 9-2 example of output of programmable pulse generation (ppg) in this mode, by enabling the double buffering of tbxrg0, the value of register buffer 0 is shifted into tbxrg0 when the set value of the up-counter matches the set value of tbxrg1. this facilitates handling of small duties. figure 9-3 register buffer operation tbxout pin match with tbxrg0 (inttbx0 interrupt) match with tbxrg1 (inttbx1 interrupt) q 2 q 1 match with tbxrg1 tbxrg0 (compare value) q 3 q 2 register buffer trigger to shift to tbxrg1 write tbxrg0 up-counter= q1 up-counter= q2 match with tbxrg0 q 5 q 4 tbxrg1 (compare value) q 6 q 5 register buffer write tbxrg1
page 9-22 9. 16-bit timer / event counters (tmrb) 9.6 description of operations for each mode TMPM372FWUG 2013/4/15 the block diagram of this mode is shown below. figure 9-4 block diagram of 16-bit ppg mode each register in the 16-bit ppg output mo de must be programmed as listed below. note:x; don?t care ? ; no change 76543210 tbxen 1 x x x x x x x enables tmrbx operation. tbxrun x x x x x 0 x 0 stops count operation. tbxcr 00 ? x ? x 0 0 disables double buffering. tbxrg0 ******** specifies a duty. (16 bits) ******** tbxrg1 ******** specifies a cycle. (16 bits) ******** tbxcr 100x ? x 0 0 enables the tbxrg0 double buffering. (changes the duty/cycle when the inttbx0 interrupt is gener- ated) tbxffcr x x 0 0 1 1 1 0 specifies to trigger tbxff0 to reverse when a match with tbxrg0 or tbxrg1 is detected, and sets the initial value of tbxff0 to "0". tbxmod x 0 1 0 0 1 * * designates the prescaler output clock as the input clock, and disables the capture function. uc is cleared to match tbxrg1. (** = 01, 10, 11) set port registers. allocates co rresponding port to tbxout. tbxrun *****1x1 starts tmrbx. selector selector internal data bus tbxcr write tbxrg0 tbxout (ppg output) tbxrun match tbxin -t1 -t4 -t16 tbxrg0 clear 16-bit up-counter uc tbxrg1 f/f (tbxff0) selector  write tbxrg1 tbxcr 16-bit comparator 16-bit comparator register buffer 0 register buffer 1
page 9-23 TMPM372FWUG 2013/4/15 9.6.4 external trigger programmable pulse genera tion output mode (ppg) using an external count start trigger enables one-shot pulse generation with a short delay. the 16-bit up-counter (uc) is programmed to count up on the rising edge of the tbxin pin (tbxcr[1:0] = "01"). the tbxrg0 is loaded with the pulse delay (d), and the tbxrg1 is loaded with the sum of the tbxrg0 value (d) and the pulse width (p). the above settings must be done while the 16-bit up-counter is stopped (tbxrun = 0). to enable the trigger for timer flip-flop, sets tbx ffcr to "11". with this setting, the timer flip-flop reverses when 16-bit up-count er (uc) corresponds to tbxrg0 or tbxrg1. sets tbxrun to "1" to enable the count-up by an external trigger. after the generation of one-shot pulse by the external tr igger, to disable reverse of the timer flip-flop or to stop 16bit counter by tbxrun setting. symbols (d) and (p) used in the text correspond to symbols d and p in figure 9-5. figure 9-5 one-shot pulse gener ation using an exte rnal count start tr igger (with a delay) counter clock (internal clock) timer output tbxout pin tbxin input pin (external trigger pulse) match with tbxrg0 match with tbxrg1 0 (p) d d + p reverse the counter starts at the rising edge of external trigger. inttbx1 generation pulse width (d) delay time inttbx0 generation reverse
page 9-24 9. 16-bit timer / event counters (tmrb) 9.7 applications using the capture function TMPM372FWUG 2013/4/15 9.7 applications usin g the capture function the capture function can be used to develop many applications, including those described below: 1. one-shot pulse output triggered by an external pulse 2. pulse width measurement 9.7.1 one-shot pulse output triggered by an external pulse one-shot pulse output triggered by an external pulse is carried out as follows: the 16-bit up-counter is made to count up by putting it in a free-running state using the prescaler output clock. an external pulse is input through the tbxin pi n. a trigger is generated at the rising of the external pulse by using the capture function and the value of the up-counter is taken into the capture registers (tbxcp0). the cpu must be programmed so that an interrupt intcap x0 is generated at the risi ng of an external trigger pulse. this interrupt is used to set the timer register s (tbxrg0) to the sum of the tbxcp0 value (c) and the delay time (d), (c + d), and set the timer registers (tbxrg1) to the sum of the tbxrg0 values and the pulse width (p) of one-shot pulse, (c + d + p).[tbxrg1 change must be completed before the next match.] in addition, the timer flip-flop control registers(tbxffcr) must be set to "11". this enables triggering the timer flip-flop (tbxff0) to reverse when tbxuc matches tbxrg0 and tbxrg1. this trigger is disabled by the inttbx0 / inttbx1 interrupt after a one-shot pulse is output. symbols (c), (d) and (p) used in the text correspond to symbols c, d and p in figure 9-6. figure 9-6 one-shot pu lse output (with delay) count clock (internal clock) timer output tbxout pin tbxin pin input (external trigger pulse) match with tbxrg0 match with tbxrg1 c (p) c + d c + d + p enable reverse enable reverse put the counter in a free-running state. taking data into the capture register (tbxcp0). inttbx1 generation disable reverse when data is taken into tbxcp0. pulse width (d) delay time inttbx0 generation intcapx0 generation
page 9-25 TMPM372FWUG 2013/4/15 the followings show the settings in the case that 2 ms width one-shot pulse is output after 3ms by triggering tbxin input at the rising edge. ( t1 is selected for counting.) note:x; don?t care ? ; no change if a delay is not required, tbxff0 is reversed when data is taken into tbxcp0, and tbxrg1 is set to the sum of the tbxcp0 value (c) and the one-shot pulse width (p), (c + p), by generating the intcapx0 interrupt. tbxrg1 change must be completed before the next match. tbxff0 is enabled to reverse when uc matches with tbxrg1, and is disabled by generating the inttbx1 interrupt. figure 9-7 one-shot pulse output triggered by an external pulse (without delay) 76543210 [[main processing] capture setting by tbxin set port registers. allocates corresponding port to tbxin. tbxen 1 x x x x x x x enables tmrbx operation. tbxrun x x x x x 0 x 0 stops count operation. tbxmod x0101001 changes source clock to t1. fetches a count value into the tbxcp0 at the rising edge of tbxin. tbxffcr x x 0 0 0 0 1 0 clears tbxff0 reverse trigger and disables. set port registers. allocates corresponding port to tbxout. interrupt set-enable register ******** permits to generate interrupts specified by intcapx0 inter- rupt corresponding bit by setting to "1". tbxrun *****1x1 starts the tmrbx module. [processing of intcapx0 interrupt service routine] pulse output setting tbxrg0 ******** sets count value.(tbxcap0 + 3ms/ t1) ******** tbxrg1 ******** sets count value.(tbxcap0 + (3+2)ms/ t1) ******** tbxffcr xx ?? 11 ?? reverses tbxff0 if uc consistent with tbxrg0 and tbxrg1. tbxim xxxxx1 01 masks except tbxrg1 correspondence interrupt. interrupt set-enable register ******** permits to generate interrupt specified by inttbx interrupt corresponding bit setting to "1". [processing of inttbx interrupt service routine] output disable tbxffcr xx ?? 00 ?? clears tbxff0 reverse trigger setting. ******** prohibits interrupts specified by inttbx interrupt correspond- ing bit by setting to "1". count clock (prescaler output clock) timer output tbxout pin tbxin input (external trigger pulse) match with tbxrg1 c (p) c + p enable reverse inttbx1 generation enable reverse when data is taken into tbxcp0. taking data into the capture register tbxcp0. taking data into the capture register tbxcp1. disable reverse when data is taken into tbxcp1. pulse width intcapx0 generation
page 9-26 9. 16-bit timer / event counters (tmrb) 9.7 applications using the capture function TMPM372FWUG 2013/4/15 9.7.2 pulse width measurement by using the capture function, the "high" level width of an external pulse can be measured. specifically, by putting it in a free-running state using the prescaler outp ut clock, an external pulse is input through the tbxin pin and the up-counter (uc) is made to count up. a trigger is generated at each rising and falling edge of the external pulse by using the capture function and the valu e of the up-counter is taken into the capture registers (tbxcp0, tbxcp1). the cpu must be programmed so that intcapx1 is generated at the falling edge of an external pulse input through the tbxin pin. the "high" level pulse width can be calculated by multiplying the difference between tbxcp0 and tbxcp1 by the clock cycle of an internal clock. for example, if the difference betw een tbxcp0 and tbxcp1 is 100 and the cycle of the prescaler output clock is 0.5 s, the pulse width is 100 0.5 s = 50 s. caution must be exercised when measuring pulse wi dths exceeding the uc maximum count time which is dependant upon the source clock used. the measurement of such pulse widths must be made using software. the "low" level width of an external pulse can also be measured. in such cases, the difference between c2 generated the first time and c1 generated the second ti me is initially obtained by performing the second stage of intcapx0 interrupt processing as shown in figure 9-8 and this difference is multiplied by the cycle of the prescaler output clock to obtain the "low" level width. figure 9-8 pulse width measurement prescaler output clock taking data into tbxcp1 tbxin pin input (external pulse) taking data into tbxcp0 c1 c1 c1 c2 c2 c2 intcapx1 intcapx0
page 10-1 TMPM372FWUG 2013/4/15 10. serial channel (sio/uart) 10.1 overview this device has two mode for the serial channel, one is the synchronous communication mode (i/o interface mode), and the other is the asynchron ous communication mode (uart mode). their features are given in the following. ? transfer clock - dividing by the prescaler, from the peripheral clock ( t0) frequency into 1/2, 1/8, 1/32, 1/128. - make it possible to divide from the prescaler output clock frequency into 1-16. - make it possible to divide from the prescaler out put clock frequency into 1, n+m/16 (n=2-15, m=1- 15). (only uart mode) - the usable system clock (only uart mode). ? double buffer /fifo the usable double buffer function, and the usable fifo buffers of transmit and receive in all for maxi- mum 4-byte. ? i/o interface mode - transfer mode: the half duplex (transmit/receive), the full duplex - clock: output (fixed rising edge) /i nput (selectable rising/falling edge) - make it possible to specify the interval time of continuous transmission. ? uart mode - data length: 7 bits, 8bits, 9bits - add parity bit (to be against 9bits data length) - serial links to use wake-up function - handshaking function with cts pin in the following explanation, "x" represents channel number. 10.2 difference in the spec ifications of sio modules TMPM372FWUG has four sio channels. each channel functions independently. the used pins , interrupt, dma request and uart source clock in each channel are collected in the following. table 10-1 difference in the specifications of sio modules pin name interrupt uart source clock txd rxd ctsx / sclkx receive interrupt transmit interrupt channel 0 pe0 pe1 pe2 intrx0 inttx0 tb4out channel 1 pa5 pa6 pa4 intrx1 inttx1 tb4out channel 2 pd5 pd6 pd4 intrx2 inttx2 tb7out channel 3 pf3 pf4 pf2 intrx3 inttx3 tb7out
page 10-2 10. serial channel (sio/uart) 10.3 configuration TMPM372FWUG 2013/4/15 10.3 configuration figure 10-1 shows sio block diagram. figure 10-1 sio block diagram t0 f sys - t1 - t4 - t16 - t64 - t1 scxbrcr tbxout (from tmrbx) scxbrcr scxcr sioclk scxmod0 scxmod0 txdclk scxcr scxmod0 scxmod0 scxmod0 scxbrcr scxbradd prescaler uart mode sclkx input sclkx output rxdx txdx interrupt request intrxx interrupt request inttxx 1 2 scxcr i/o interface mode ctsx rxdclk 2 4 8 16 32 64 128 - t4 - t16 - t64    baud rate generator i/o interface mode transmission counter (only at uart : 16) serial channel interrupt control transmission control recive control recive shift register tb8 transmission buffer (scxbuf) rb8 recive buffer (scxbuf) parity control fifo control error flag fifo control int e rn a l da t a bus int e rn a l da t a bus internal data bus selector selector selector selector transmission shift register divider serial clock generation circuit recive counter (only at uart : 16)
page 10-3 TMPM372FWUG 2013/4/15 10.4 registers description 10.4.1 registers list in each channel the each channel registers and addresses are shown below. note: do not modify any control register when data is being transmitted or received. channel x base address channel0 0x4002_0080 channel1 0x4002_00c0 channel2 0x4002_0100 channel3 0x4002_0140 register name (x=0,1,2,3) address (base+) enable register scxen 0x0000 buffer register scxbuf 0x0004 control register scxcr 0x0008 mode control register 0 scxmod0 0x000c baud rate generator control register scxbrcr 0x0010 baud rate generator control register 2 scxbradd 0x0014 mode control register 1 scxmod1 0x0018 mode control register 2 scxmod2 0x001c rx fifo configuration register scxrfc 0x0020 tx fifo configuration register scxtfc 0x0024 rx fifo status register scxrst 0x0028 tx fifo status register scxtst 0x002c fifo configuration register scxfcnf 0x0030
page 10-4 10. serial channel (sio/uart) 10.4 registers description TMPM372FWUG 2013/4/15 10.4.2 scxen (enable register) note:when scxen is cleared to "0" (disable sio oper ation) or the operation mode transits to idle mode by setting scxmod1 to "0", it is necessary to reset scxtfc. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------sioe after reset00000000 bit bit symbol type function 31-1 ? r read as 0. 0 sioe r/w sio operation 0: disabled 1: enabled specified the sio operation. to use the sio, set = "1". when the operation is disabled, no cl ock is supplied to the other register s in the sio module. this can reduce the power consumption. if the sio operation is executed and then disabled, the se ttings will be maintained in each register except for scxtfc.
page 10-5 TMPM372FWUG 2013/4/15 10.4.3 scxbuf (buffer register) scxbuf works as a transmit buffer or fifo for write operat ion and as a receive bu ffer or fifo for read operation. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol tb / rb after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-0 tb[7:0] / rb[7:0] r/w [write] tb : transmit buffer / fifo [read] rb : receive buffer / fifo
page 10-6 10. serial channel (sio/uart) 10.4 registers description TMPM372FWUG 2013/4/15 10.4.4 scxcr (control register) note: any error flag (oerr, perr, ferr) is cleared to "0" when read. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol rb8 even pe oerr perr ferr sclks ioc after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 rb8 r receive data bit 8 (for uart) 9th bit of the received data in the 9 bits uart mode. 6 even r/w parity (for uart) 0: odd 1: even selects even or odd parity. "0" : odd parity, "1" : even parity. the parity bit may be used only in the 7- or 8-bit uart mode. 5 pe r/w add parity (for uart) 0: disabled 1: enabled controls enabling/ disabling parity. the parity bit may be used only in the 7- or 8-bit uart mode. 4 oerr r overrun error flag (note) 0: normal operation 1: error 3 perr r parity / under-run error flag (note) 0: normal operation 1: error 2 ferr r framing error flag (note) 0: normal operation 1: error 1 sclks r/w selects input clock edge for data transmission and reception. (for i/o interface) 0: data in the transmit buffer is sent to txdx pin one bit at a time on the falling edge of sclkx. data from rxdx pin is received in the receiv e buffer one bit at a time on the rising edge of sclkx. in this case, the sclk starts from high level. 1: data in the transmit buffer is sent to txdx pin one bit at a time on the rising edge of sclkx. data from rxdx pin is received in the receiv e buffer one bit at a time on the falling edge of sclkx. in this case, the sclk starts from low level. set to "0" in the clock output mode. 0 ioc r/w selecting clock (for i/o interface) 0: baud rate generator 1: sclk pin input
page 10-7 TMPM372FWUG 2013/4/15 10.4.5 scxmod0 (mode control register 0) note 1: with set to "0", set each mode regist er (scxmod0, scxmod1 and scxmod2). then set to "1". note 2: do not stop the receive operation (by setting scxmod0 = "0") when data is being received. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol tb8 ctse rxe wu sm sc after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 tb8 r/w transmit data bit 8 (for uart) writes the 9th bit of transmit data in the 9 bits uart mode. 6 ctse r/w handshake function control (for uart) 0: cts disabled 1: cts enabled controls handshake function. setting "1" enables handshake function using cts pin. 5 rxe r/w receive control (note1)(note2) 0: disabled 1: enabled 4 wu r/w wake-up function (for uart) 0: disabled 1: enabled this function is available only at 9-bit uart m ode. in other mode, this function has no meaning. in it is enabled, interrupt only when rb9 = "1" at 9-bit uart mode. 3-2 sm[1:0] r/w specifies transfer mode. 00: i/o interface mode 01: 7-bit length uart mode 10: 8-bit length uart mode 11: 9-bit length uart mode 1-0 sc[1:0] r/w serial transfer clock (for uart) 00: timer tbxout (refer to table 10-1) 01: baud rate generator 10: internal clock fsys 11: external clock (sclk input) (as for the i/o interface mode, the serial transfer clock can be set in the control register (scxcr).
page 10-8 10. serial channel (sio/uart) 10.4 registers description TMPM372FWUG 2013/4/15 10.4.6 scxmod1 (mode control register 1) note 1: specify the all mode first and then enable the bit. note 2: do not stop the transmit operation (by setting = "0") when data is being transmitted. note 3: when scxen is cleared to "0" (disable si o operation) or the operation mode transits to idle mode by setting scxmod1 to "0", it is necessary to reset scxtfc. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol i2s0 fdpx txe sint - after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 i2s0 r/w idle 0: stop 1: operate specifies the idle mode operation. 6-5 fdpx[1:0] r/w transfer mode setting 00: transfer prohibited 01: half duplex (receive) 10: half duplex (transmit) 11: full duplex configures the transfer mode in the i/o interface m ode. also configures the fifo if it is enabled. in the uart mode, it is used only to specify the fifo configuration. 4 txe r/w transmit control (note1)(note2) 0 :disabled 1: enabled this bit enables transmission and is valid for all the transfer modes. 3-1 sint[2:0] r/w interval time of continuous transmission (for i/o interface) 000: none 001: 1sclk 010: 2sclk 011: 4sclk 100: 8sclk 101: 16sclk 110: 32sclk 111: 64sclk this parameter is valid only for the i/o interface mode when sclk pin output is selected. in other modes, this function has no meaning. specifies the interval time of continuous transmission when double buffering or fifo is enabled in the i/o in- terface mode. 0 ? r/w write a "0".
page 10-9 TMPM372FWUG 2013/4/15 10.4.7 scxmod2 (mode control register 2) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol tbemp rbfll txrun sblen drchg wbuf swrst after reset10000000
page 10-10 10. serial channel (sio/uart) 10.4 registers description TMPM372FWUG 2013/4/15 note 1: while data transmission is in progress, any softwa re reset operation must be executed twice in succession. note 2: a software reset requires 2 clocks-duration at the time between the end of recognition and the start of exe- cution of software reset instruction. bit bit symbol type function 31-8 ? r read as 0. 7 tbemp r transmit buffer empty flag. 0: full 1: empty if double buffering is disabled, this flag is insignificant. this flag shows that the transmit double buffers are em pty. when data in the transmit double buffers is moved to the transmit shift register and the double buffers are empty, this bit is set to "1". writing data again to the double buffers sets this bit to "0". 6 rbfll r receive buffer full flag. 0: empty 1: full if double buffering is disabled, this flag is insignificant. this is a flag to show that t he receive double buffers are full. when a receive operation is completed and received data is moved from the receive shift register to the receive double buffers, this bit changes to "1" wh ile reading this bit changes it to "0". 5 txrun r in transmission flag 0: stop 1: operate this is a status flag to show t hat data transmission is in progress. and bits indicate the following status. status 1 ? transmission in progress 0 1 transmission completed 0 wait state with data in transmit buffer 4 sblen r/w stop bit (for uart) 0 : 1-bit 1 : 2-bit this specifies the length of transmission stop bit in the uart mode. on the receive side, the decision is made using only a single bit regardless of the setting. 3 drchg r/w setting transfer direction 0: lsb first 1: msb first specifies the direction of data transfer in the i/o interface mode. in the uart mode, set this bit to lsb first. 2 wbuf r/w double-buffer 0: disabled 1 : enabled this parameter enables or disables the transmit/receive double buffers to transmit (in both sclk output/input modes) and receive (in sclk output mode) data in the i/o interface mode and to transmit data in the uart mode. when receiving data in the i/o interface mode (sclk input) and uart mode, double buffering is enabled in both cases that 0 or 1 is set to bit. 1-0 swrst[1:0] r/w software reset overwriting "01" in place of "10" generates a software reset. when this software reset is executed, the following bits are initialized : register bit scxmod0 scxmod1 scxmod2 , , scxcr , , the transmit/receive circuit and the fifo become initial state (see note1 and note2).
page 10-11 TMPM372FWUG 2013/4/15 10.4.8 scxbrcr (baud rate generator control register), scxbra dd (baud rate gen- erator control register 2) the division ratio of the baud rate generator can be specified in the registers shown below. scxbrcr 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - bradde br0ck br0s after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 ? r/w write "0". 6 bradde r/w n + (16 ? k)/16 divider function (for uart) 0: disabled 1: enabled this division function can only be used in the uart mode. 5-4 br0ck[1:0] r/w select input clock to the baud rate generator 00: t1 01: t4 10: t16 11: t64 3-0 br0s[3:0] r/w division ratio "n" 0000: 16 0001: 1 0010: 2 ... 1111: 15
page 10-12 10. serial channel (sio/uart) 10.4 registers description TMPM372FWUG 2013/4/15 table 10-2 lists the settings of baud rate generator division ratio. note 1: to use the "n + (16 - k)/16" division function, be sure to set to "1" after setting the k value to . the "n + (16 - k)/16" division function can only be used in the uart mode. note 2: as a division ratio, 1 ("0001") or 16 ("0000") can not be applied to n when using the "n + (16 - k)/16" division function in the uart mode. note 3: the division ratio "1" of the baud rate generator can be specified only when the double buffering is used in the i/o interface mode. note 4: specifying "k = 0" is prohibited. scxbradd 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol---- br0k after reset00000000 bit bit symbol type function 31-4 ? r read as 0. 3-0 br0k[3:0] r/w specify k for the "n + (16 ? k)/16" division (for uart) 0000: prohibited 0001: k = 1 0010: k = 2 ... 1111: k = 15 table 10-2 setting division ratio = "0" = "1" (note1) (only uart mode) specify "n" (note2) (note3) no setting required specify "k" (note4) division ratio divide by n n + (16 ? k) 16 glylvlrq
page 10-13 TMPM372FWUG 2013/4/15 10.4.9 scxfcnf (fifo c onfiguration register) note 1: regarding tx fifo, the maximum number of byte s being configured is always available. the avail- able number of bytes is the bytes already written to the tx fifo. note 2: the fifo can not use in 9bit uart mode. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - - rfst tfie rfie rxtxcnt cnfg after reset00000000 bit bit symbol type function 31-8 - r read as 0 7-5 - r/w be sure to write "000" 4 rfst r/w bytes used in rx fifo 0:maximum 1:same as fill level of rx fifo when rx fifo is enabled, the number of rx fifo bytes to be used is selected (note1) 0: the maximun number of bytes of the fifo configured (see also ). 1: same as the fill level for receive inte rrupt generation specified by scxrfc 3 tfie r/w tx interrupt for tx fifo 0: disabled 1: enabled when tx fifo is enabled, transmit interrupts are enabled or disabled by this parameter. 2 rfie r/w rx interrupt for rx fifo 0: disabled 1: enabled when rx fifo is enabled, receive interrupts are enabled or disabled by this parameter. 1 rxtxcnt r/w automatic disable of / 0: none 1: auto disabled controls automatic disabling of transmission and reception. setting "1" enables to operate as follows half duplex rx when receive shift register, the receive buffer and the rx fifo are filled, scxmod0 is automatically set to "0" to inhibit further reception. half duplex tx when the tx fifo, the transmit buffer and the transmit shift register is empty, scxmod1 is automatically set to "0" to inhibit further transmission. full duplex when either of the above two conditions is satisfied, / are automati- cally set to "0" to inhibit further transmission and reception. 0 cnfg r/w enables fifo (note2) 0: disabled 1: enabled if enabled, the scxmod1 setting aut omatically configures fifo as follows: (the type of tx/rx can be specified in the mode control register 1 scxmod1). half duplex rx rx fifo 4byte half duplex tx tx fifo 4byte full duplex rx fifo 2byte + tx fifo 2byte
page 10-14 10. serial channel (sio/uart) 10.4 registers description TMPM372FWUG 2013/4/15 10.4.10scxrfc (rx fifo configuration register) note:to use tx/rx fifo buffer, tx/rx fifo must be clea red after setting the sio transfer mode (half duplex/full duplex) and enabling fifo (scxfcnf = "1"). 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolrfcsrfis---- ril after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 rfcs w rx fifo clear (note) 1: clears rx fifo when scxrfc is set to "1", the receive fifo is cleared and scxrst is "000". and also the read pointer is initialized. 6 rfis r/w select interrupt generation condition 0: an interrupt is generated when the data reaches to the specified fill level. 1: an interrupt is generated when the data reaches to the specified fill level or t he data exceeds the specified fill level at the time data is read. 5-2 ? r read as 0. 1-0 ril[1:0] r/w fifo fill level to generate rx interrupts half duplex full duplex 00 4byte 2byte 01 1byte 1byte 10 2byte 2byte 11 3byte 1byte
page 10-15 TMPM372FWUG 2013/4/15 10.4.11scxtfc (tx fifo configuration register) (note2) note 1: to use tx/rx fifo buffer, tx/rx fifo must be cleared after setting the sio transfer mode (half duplex/full duplex) and enabling fifo (scxfcnf = "1"). note 2: after you perform the following operations, configure the scxtfc register again. scxen = "0" (sio operation stop) conditions are as follows:scxmod1 = "0" (operation is prohibited in idle mode) and releas- ing the low power consumption mode which started by the wfi (wait for interrupt) instruction. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symboltfcstfis---- til after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 tfcs w tx fifo clear (note 1) 1: clears tx fifo. when scxtst is set to "1", the transmit fifo is cleared and scxrst is "000". and also the write pointer is initialized. 6 tfis r/w selects interrupt generation condition. 0: an interrupt is generated when the data reaches to the specified fill level. 1: an interrupt is generated when the data reaches to the specified fill level or the data can not reach the spec- ified fill level at the time new data is read. 5-2 ? r read as 0. 1-0 til[1:0] r/w fifo fill level to generate tx interrupts. other than full duplex full duplex 00 empty empty 01 1 byte 1 byte 10 2 byte empty 11 3 byte 1 byte
page 10-16 10. serial channel (sio/uart) 10.4 registers description TMPM372FWUG 2013/4/15 10.4.12scxrst (rx fifo status register) note: the bit is cleared to "0" when receive data is read from the scxbuf register. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolror---- rlvl after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7 ror r rx fifo overrun (note) 0: not generated 1: generated 6-3 ? r read as 0. 2-0 rlvl[2:0] r status of rx fifo fill level. 000: empty 001: 1 byte 010: 2 byte 011: 3 byte 100: 4 byte
page 10-17 TMPM372FWUG 2013/4/15 10.4.13scxtst (tx fifo status register) note: the bit is cleared to "0" when transmit data is written to the scxbuf register. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symboltur---- tlvl after reset10000000 bit bit symbol type function 31-8 ? r read as 0. 7 tur r tx fifo under run (note) 0: not generated 1: generated. 6-3 ? r read as 0. 2-0 tlvl[2:0] r status of tx fifo fill level. 000: empty 001: 1 byte 010: 2 byte 011: 3 byte 100: 4 byte
page 10-18 10. serial channel (sio/uart) 10.5 operation in each mode TMPM372FWUG 2013/4/15 10.5 operation in each mode table 10-3 shows the modes and data formats. mode 0 is a synchronous comm unication and can be used to extend i/o. this mode transmits and receives data in synchronization with sclk. sclk can be used for both input and output. the direction of data transfer can be se lected from lsb first and msb first. th is mode is not allowed either to use parity bits or stop bits. the mode 1, mode 2 and mode 3 are asynchronous modes and the transfer direction is fixed to the lsb first. parity bits can be added in the mode 1 and mode 2. the mode 3 has a wakeup function in which the master control- ler can start up slave controllers via th e serial link (multi-controller system). stop bit in transmission can be select ed from 1 bit and 2 bits. the stop bit length in reception is fixed to a one bit. table 10-3 mode and data format mode mode type data length transfer direction specifies whether to use parity bits. stop bit length (transmit) mode 0 synchronous communication mode (io interface mode) 8 bit lsb first/msb first - - mode 1 asynchronous communica- tion mode (uart mode) 7 bit lsb first 1 bit or 2 bit mode 2 8 bit mode 3 9 bit
page 10-19 TMPM372FWUG 2013/4/15 10.6 data format 10.6.1 data format list figure 10-2 shows data format. figure 10-2 data format mode1 (7bits uart mode) bit 0 1 2 3 4 5 6 stop start without parity bit 0 1 2 3 4 5 6 parity stop start with parity mode2 (8bits uart mode) bit 0 1 2 3 4 5 6 start 7 stop without parity bit 0 1 2 3 4 5 6 7 parity stop start with parity stop bit 0 1 2 3 4 5 6 start 7 8 bit 0 1 2 3 4 5 6 7 bit 8 stop (wake-up) start mode3 (9bits uart mode) bit 8 = 1 represents address. (select code) bit 8 = 0 represents data. 1 bit 0 2 3 4 5 6 mode0 (i/o interface mode) / lsb first transmission direction 7 6 bit 7 5 4 3 2 1 mode0 (i/o interface mode ) / msb first transmission direction 0
page 10-20 10. serial channel (sio/uart) 10.6 data format TMPM372FWUG 2013/4/15 10.6.2 parity control the parity bit can be added only in the 7 or 8-bit uart mode. setting "1" to scxcr enables the parity. the bit of scxcr select s either even or odd parity. 10.6.2.1 transmission upon data transmission, the parity control circuit automatically generates the parity with the data in the transmit buffer. after data transmission is complete, the parity bit will be stored in scxbuf in the 7-bit uart mode and scxmod0 in the 8-bit uart mode. the and settings must be completed before data is written to the transmit buffer. 10.6.2.2 receiving data if the received data is move d from the receive shift register to th e receive buffer, a parity is generated. in the 7-bit uart mode, the generated parity is compared with the parity stored in scxbuf, while in the 8-bit uart mode, it is compared with the one in scxcr. if there is any difference, a parity error occurs and the of the scxcr register is set to "1". in use of the fifo, indicates that a parity error was ge nerated in one of the received data. 10.6.3 stop bit length the length of the stop bit in the uart transmission mode can be selected from one bit or two bits by set- ting the scxmod2. the length of the stop bit da ta is determined as one-bit when it is received regardless of the setting of this bit.
page 10-21 TMPM372FWUG 2013/4/15 10.7 clock control 10.7.1 prescaler there is a 7-bit prescaler to divide a prescaler input clock t0 by 2, 8, 32 and 128. use the cgsyscr register in the clock/mode control block to select the input clock t0 of the prescaler. the prescaler becomes active only when the baud rate generator is selected as a transfer clock by scxmod0 = "01". table 10-4 show the resolution of the input clock to the baud rate generator.
page 10-22 10. serial channel (sio/uart) 10.7 clock control TMPM372FWUG 2013/4/15 table 10-4 clock resolution to the baud rate generator fc = 80 mhz peripheral clock selection cgsyscr clock gear value cgsyscr prescaler clock selection cgsyscr prescaler output clock resolution t1 t4 t16 t64 0 (fgear) 000 (fc) 000 (fperiph/1) fc/2 1 (0.025 s) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 001 (fperiph/2) fc/2 2 (0.05 s) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 010 (fperiph/4) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 100 (fc/2) 000 (fperiph/1) fc/2 2 (0.05 s) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 001 (fperiph/2) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 010 (fperiph/4) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 011 (fperiph/8) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 100 (fperiph/16) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 101 (fperiph/32) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) fc/2 13 (102.4 s) 101 (fc/4) 000 (fperiph/1) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 001 (fperiph/2) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 010 (fperiph/4) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 011 (fperiph/8) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 100 (fperiph/16) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) fc/2 13 (102.4 s) 101 (fperiph/32) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) fc/2 14 (204.8 s) 110 (fc/8) 000 (fperiph/1) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 001 (fperiph/2) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 010 (fperiph/4) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 011 (fperiph/8) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) fc/2 13 (102.4 s) 100 (fperiph/16) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) fc/2 14 (204.8 s) 101 (fperiph/32) fc/2 9 (6.4 s) fc/2 11 (25.6 s) fc/2 13 (102.4 s) fc/2 15 (409.6 s) 111 (fc/16) 000 (fperiph/1) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 001 (fperiph/2) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 010 (fperiph/4) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) fc/2 13 (102.4 s) 011 (fperiph/8) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) fc/2 14 (204.8 s) 100 (fperiph/16) fc/2 9 (6.4 s) fc/2 11 (25.6 s) fc/2 13 (102.4 s) fc/2 15 (409.6 s) 101 (fperiph/32) fc/2 10 (12.8 s) fc/2 12 (51.2 s) fc/2 14 (204.8 s) fc/2 16 (819.2 s)
page 10-23 TMPM372FWUG 2013/4/15 note 1: the prescaler output clock tn must be selected so that the relationship " tn fsys / 2" is satisfied (so that tn is slower than fsys). note 2: do not change the clock gear while sio is operating. note 3: the dashes in the above table indicate that the setting is prohibited. 1 (fc) 000 (fc) 000 (fperiph/1) fc/2 1 (0.025 s) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 001 (fperiph/2) fc/2 2 (0.05 s) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 010 (fperiph/4) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 100 (fc/2) 000 (fperiph/1) ? fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 001 (fperiph/2) fc/2 2 (0.05 s) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 010 (fperiph/4) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 101 (fc/4) 000 (fperiph/1) ? fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) 001 (fperiph/2) ? fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 010 (fperiph/4) fc/2 3 (0.1 s) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 110 (fc/8) 000 (fperiph/1) ? ? fc/2 5 (0.4 s) fc/2 7 (1.6 s) 001 (fperiph/2) ? fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) 010 (fperiph/4) ? fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 011 (fperiph/8) fc/2 4 (0.2 s) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) 111 (fc/16) 000 (fperiph/1) ? ? fc/2 5 (0.4 s) fc/2 7 (1.6 s) 001 (fperiph/2) ? ? fc/2 6 (0.8 s) fc/2 8 (3.2 s) 010 (fperiph/4) ? fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) 011 (fperiph/8) ? fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) 100 (fperiph/16) fc/2 5 (0.4 s) fc/2 7 (1.6 s) fc/2 9 (6.4 s) fc/2 11 (25.6 s) 101 (fperiph/32) fc/2 6 (0.8 s) fc/2 8 (3.2 s) fc/2 10 (12.8 s) fc/2 12 (51.2 s) table 10-4 clock resolution to the baud rate generator fc = 80 mhz peripheral clock selection cgsyscr clock gear value cgsyscr prescaler clock selection cgsyscr prescaler output clock resolution t1 t4 t16 t64
page 10-24 10. serial channel (sio/uart) 10.7 clock control TMPM372FWUG 2013/4/15 10.7.2 serial clock generation circuit the serial clock circuit is a block to generate transmit and receive clocks (sioclk) and consists of the cir- cuits in which clocks can be se lected by the settings of the baud rates generator and modes. 10.7.2.1 baud rate generator the baud rate generator generates transmit and receive clocks to determine th e serial channel transfer rate. (1) baud rate generator input clock the input clock of the baud rate generator is selected from the prescaler outputs divided by 2, 8, 32 and 128. this input clock is selected by setting the scxbrcr. (2) baud rate generator output clock the frequency division ratio of th e output clock in the baud rate generator is set by scxbrcr and scxbradd. the following frequency divide ratios can be used; 1/n frequency division in the i/o interface mode ,either 1/n or n + (16-k)/16 in the uart mode. the table below shows the frequency division ratio which can be selected. note: 1/n (n = 1)frequency division ratio can be used only when a double buffer is enabled. mode divide function setting scxbrcr divide by n scxbrcr divide by k scxbradd i/o interface divide by n 1 to 16 (note) - uart divide by n 1 to 16 - n + (16-k)/16 division 2 to 15 1 to 15
page 10-25 TMPM372FWUG 2013/4/15 10.7.2.2 clock selection circuit a clock can be selected by set ting the modes and the register. modes can be specified by setting the scxmod0. the input clock in i/o interface mo de is selected by setting scx cr. the clock in uart mode is selected by setting scxmod0. (1) transfer clock in i/o interface mode table 10-5 shows clock sel ection in i/o interface mode. to get the highest baud rate, the baud rate generator must be set as below. note: when deciding clock settings, make sure that ac electrical character is satisfied. ? clock/mode control block settings - fc = 80mhz - fgear = 80mhz (cgsyscr = "000" : fc selected) - t0 = 80mhz (cgsyscr = "000" : 1 division ratio) ? sio settings (if double buffer is used) - clock (scxbrcr = "00" : t1 selected) = 40mhz - divided clock frequency (scxbrcr = "0001" : 1 division ratio) = 40mhz 1 division ratio can be selected if double buffer is used. in this case, baud rate is 20mbps because 40mhz is divided by 2. ? sio settings (if double buffer is not used) - clock (scxbrcr = "00" : t1 selected) = 40mhz - divided clock frequency (scxbrcr = "0010" : 2 division ratio) = 20mhz 2 division ratio is the highest if double buffer is not used. in this case, baud rate is 10mbps because 20mhz is divided by 2. to use sclk input, the following conditions must be satisfied. ? if double buffer is used - sclk cycle > 6/fsys the highest baud rate is less than 80 6 = 13.3 mbps. table 10-5 clock selection in i/o interface mode mode scxmod0 input/output selection scxcr clock edge selection scxcr clock of use i/o interface mode sclk output set to "0". (fixed to the rising edge) divided by 2 of the baud rate gen- erator output. sclk input rising edge sclk input rising edge falling edge sclk input falling edge
page 10-26 10. serial channel (sio/uart) 10.7 clock control TMPM372FWUG 2013/4/15 ? if double buffer is not used - sclk cycle > 8/fsys the highest baud rate is less than 80 8 = 10 mbps. (2) transfer clock in the uart mode table 10-6 shows the clock selection in the ua rt mode. in the uart mode, selected clock is divided by 16 in the receive counter or the transmit co unter before use. the examples of baud rate in each clock settings. ? if the baud rate generator is used - fc = 80mhz - fgear = 80mhz (cgsyscr = "000" : fc selected) - t0 = 80mhz (cgsyscr = "000" : 1 division ratio) -clock = t1 = 40mhz (scxbrcr = "00" : t1 selected) the highest baud rate is 2.5mbp s because 40mhz is divided by 16. table 10-7 shows examples of baud rate when the baud rate generator is used with the fol- lowing clock settings. ? fc = 9.8304mhz ? fgear = 9.8304mhz (cgsyscr = "000" : fc selected) ? t0 = 4.9152mhz (cgsyscr = "001" : 2 division ratio) ? if the sclk input is used table 10-6 clock selection in uart mode mode scxmod0 clock selection scxmod0 uart mode timer output baud rate generator fsys sclk input table 10-7 example of uart mode baud rate (using the baud rate generator) fc [mhz] division ratio n (scxbrcr) t1 (fc/4) t4 (fc/16) t16 (fc/64) t64 (fc/256) 9.830400 2 76.800 19.200 4.800 1.200 4 38.400 9.600 2.400 0.600 8 19.200 4.800 1.200 0.300 16 9.600 2.400 0.600 0.150 unit  kbps
page 10-27 TMPM372FWUG 2013/4/15 to use sclk input, the following conditions must be satisfied. - sclk cycle > 2/fsys the highest baud rate must be less than 80 2 16 = 2.5 mbps. ? if fsys is used since the highest value of fsys is 80mhz, the highest baud rate is 80 16 = 5mbps. ? if timer output is used to enable the timer output, the following condition must be set: a timer flip-flop output inverts when the value of the counter and th at of tbxrg1 match. the sioclk clock fre- quency is "setting value of tbxrg1 2". baud rates can be obtained by using the following formula. table 10-8 shows the examples of baud rates when the timer output is used with the follow- ing clock settings. ? fc = 80mhz / 9.8304mhz / 8mhz ? fgear = 80mhz / 9.8304mhz / 8mhz (cgsyscr = "000" : fc selected) ? t0 = 40mhz / 4.9152mhz / 4mhz (cgsyscr = "001" : 2 division ra- tio) ? timer count clock = 4mhz / 1.2287mhz / 1mhz (tbxmod = "01" : t1 selected) table 10-8 example of uart mode baud rate (using the timer output) tbxrg0 setting fc 80mhz 9.8304mhz 8mhz 0x0001 625 76.8 62.5 0x0002 312.5 38.4 31.25 0x0003 - 25.6 - 0x0004 156.25 19.2 15.625 0x0005 125 15.36 12.5 0x0006 - 12.8 - 0x0008 78.125 9.6 - 0x000a 62.5 7.68 6.25 0x0010 39.025 4.8 - 0x0014 31.25 3.84 3.125 unit  kbps baud rate calculation transfer rate = clock frequency selected by cgsyscr (tbxrg1 2) 2 16 in the case the timer prescaler clock t1 (2divition ratio) is selected. one clock cycle is a period that the timer flip-flop is inverted twice.
page 10-28 10. serial channel (sio/uart) 10.8 transmit/receive buffer and fifo TMPM372FWUG 2013/4/15 10.8 transmit/receive buffer and fifo 10.8.1 configuration figure 10-3 shows the configuration of transmit buffer, receive buffer and fifo. appropriate settings are required for using buffer an d fifo. the configuration may be predefined depending on the mode. figure 10-3 the configur ation of buffer and fifo 10.8.2 transmit/receive buffer transmit buffer and receive buffer are double-bu ffered. the buffer configuration is specified by scxmod2. in the case of using a receive buffer, if sclk input is set to generate clock output in the i/o interface mode or the uart mode is selected, it?s double buffered desp ite the settings. in other modes, it?s accord- ing to the settings. table 10-9 shows correlation between modes and buffers. table 10-9 mode and buffer composition mode scxmod2 "0" "1" uart transmit single double receive double double i/o interface (sclk input) transmit single double receive double double i/o interface (sclk output) transmit single double receive single double 6tcpuokv(+(1 6tcpuokvdwhhgt 6tcpuokvujkhvtgikuvgt 6:& 4gegkxg (+(1 (ktuvuvcig 5geqpfuvcig 6jktfuvcig (qwtvjuvcig 4gegkxgdwhhgt 4gegkxgujkhvtgikuvgt 4:& (ktuvuvcig 5geqpfuvcig 6jktfuvcig (qwtvjuvcig
page 10-29 TMPM372FWUG 2013/4/15 10.8.3 fifo in addition to the double buffer function above described, 4-byte fifo can be used. to enable fifo, enable the doubl e buffer by setting scxmod2 to "1" and scxfcnf to "1". the fifo buffer co nfiguration is specified by scxmod1. note:to use tx/rx fifo buffer, tx/rx fifo must be clea red after setting the sio transfer mode (half duplex/full duplex) and enabling fifo (scxfcnf = "1"). table 10-10 shows correlation between modes and fifo. 10.9 status flag the scxmod2 register has two types of flag. this bit is significant only when the double buffer is enabled. is a flag to show that the receive buffer is fu ll. when one frame of data is received and the data is moved from the receive shift register to the receive buffers, this bit cha nges to "1" while reading this bit changes it to "0". shows that the transmit buffers are empty. when data in the tran smit buffers is moved to the transmit shift register, this bit is set to "1" . when data is set to the transmit buffers, the bit is cleared to "0". 10.10error flag three error flags are provided in th e scxcr register. the meaning of the flags is changed depending on the modes. the table below shows the meanings in each mode. these flags are cleared to "0" af ter reading the scxcr register. table 10-10 mode and fifo composition scxmod1 rx fifo tx fifo half duplex rx "01" 4byte - half duplex tx "10" - 4byte full duplex "11" 2byte 2byte mode flag uart overrun error parity error framing error i/o interface (sclk input) overrun error underrun error (when using double buffer or fifo) fixed to 0 fixed to 0 (when a double buffer and fifo unused) i/o interface (sclk output) undefined undefined fixed to 0
page 10-30 10. serial channel (sio/uart) 10.10 error flag TMPM372FWUG 2013/4/15 10.10.1oerr flag in both uart and i/o interface modes, this bit is set to "1" when an error is generated by completing the reception of the next frame of receive data before th e receive buffer has been read. if the receive fifo is enabled, the received data is automa tically moved to the receive fifo a nd no overrun error will be generated until the receive fifo is full (or until the usable bytes are fully occupied). in the i/o interface with sclk output mode, the sclk output stops upon setting the flag. note:to switch the i/o interface sclk output mode to ot her modes, read the scxcr register and clear the overrun flag. 10.10.2perr flag this flag indicates a parity error in the uart mo de and an under-run error in the i/o interface mode. in the uart mode, is set to "1" when the pari ty generated from the received data is different from the parity received. in the i/o interface mode, is set to "1" u nder the following conditions when a double buffer is enabled. in the sclk input mode, is set to "1" when the sclk is input after completing data output of the transmit shift register with no data in the transmit buffer. in the sclk output mode, is set to "1" after completing output of all data and the sclk output stops. note:to switch the i/o interface sclk output mode to other modes, read the scxcr register and clear the under- run flag. 10.10.3ferr flag a framing error is generated if the corresponding stop bit is determined to be "0" by sampling the bit at around the center. regardless of the stop bit length settings in the scxmod2register, the stop bit status is determined by only 1. this bit is fixed to "0" in the i/o interface mode.
page 10-31 TMPM372FWUG 2013/4/15 10.11receive 10.11.1receive counter the receive counter is a 4-bit binary counter and is up-counted by sioclk. in the uart mode, sixteen sioclk clock pulses are used in r eceiving a single data bit and the data symbol is sampled at the seventh, eighth, and ninth pulses. from these three samples, majority logi c is applied to decide the received data. 10.11.2receive control unit 10.11.2.1i/o interface mode in the sclk output mode with scxcr set to "0", the rxd pin is sampled on the rising edge of the shift clock outputted to the sclk pin. in the sclk input mode wi th scxcr set to "1", the serial receive data rxd pin is sampled on the rising or falling edge of sclk input signal depending on the scxcr setting. 10.11.2.2uart mode the receive control unit has a start bit detection circuit, which is used to initiate receive operation when a normal start bit is detected. 10.11.3receive operation 10.11.3.1receive buffer the received data is stored by 1 bit in the receive sh ift register. when a comple te set of bits has been stored, the interrupt intrxx is generated. when the double buffer is enabled, the data is mo ved to the receive buffer (scxbuf) and the receive buffer full flag (scxmod2< rbfll>) is set to "1". the receive buffe r full flag is "0" cleared by reading the receive buffer. the receive buffer full flag does not have any value for the single buffer. figure 10-4 receive buffer operation data 1 data 1 receive shift register receive buffer scxmod2 receive interrupt(intrxx) receive buffer read
page 10-32 10. serial channel (sio/uart) 10.11 receive TMPM372FWUG 2013/4/15 10.11.3.2receive fifo operation when fifo is enabled, the received data is moved from receive buffer to r eceive fifo and the receive buffer full flag is cleared immediately. an inte rrupt will be generated acco rding to the scxrfc setting. note: when the data with parity bit are received in ua rt mode by using the fifo, the parity error flag is shown the occurring the parity error in the received data. the following describes configurations and operations in the half duplex rx mode. after setting of the above fifo co nfiguration, the data reception is started by writ ing "1" to the scxmod0 . when the data is stored all in the receive shift register, receive buffer and receive fifo, scxmod0 is automatically clear ed and the receive operation is finished. in this above condition, if the co ntinuous reception afte r reaching the fill level is enabled, and it is pos- sible to receive a data continuously wi th and reading the data in the fifo. figure 10-5 receive fifo operation scxmod1[6:5] = 01 : transfer mode is set to half duplex mode scxfcnf[4:0] = 10111 : automatically inhibits continuous reception after reaching the fill level. : the number of bytes to be used in the receive fifo is the same as the interrupt generation fill level. scxrfc[1:0] = 00 : the fill level of fifo in which generated receive interrupt is set to 4-byte. scxrfc[7:6] = 11 : clears receive fifo and sets the condition of interrupt generation. receive shift register receive buffer scxmod2 rx interrupt (intrxx) rx fifo the first stage the second stage the third stage the fourth stage scxmod0 data1 data1 data2 data2 data1 data3 data2 data1 data3 data4 data2 data1 data3 data4 data2 data1 data3 data4 data1 data2 data1 data3 data2 data4 data3 data4 data5 data5 data5 data6
page 10-33 TMPM372FWUG 2013/4/15 10.11.3.3i/o interface mode with sclk output in the i/o interface mode and sclk output setting, sc lk output stops when all received data is stored in the receive buffer and fifo. so, in this mode, the overrun error flag has no meaning. the timing of sclk output stop and re-out put depends on receive buffer and fifo. (1) case of single buffer stop sclk output after receiving a data. in this mode, i/o interface can transf er each data with the transfer device by hand-shake. when the data in a buffer is read, sclk output is restarted. (2) case of double buffer stop sclk output after receiving the data into a receive shift register and a receive buffer. when the data is read, sclk output is restarted. (3) case of fifo stop sclk output after receiving the data into a shift register, r eceived buffer and fifo. when one byte data is read, the data in the recei ved buffer is transferred into fifo and the data in the receive shift register is transferred into received buffer and sclk output is restarted. and if scxfcnf is set to "1", sclk stops and receive opera tion stops with clear- ing scxmod0 bit too. 10.11.3.4read received data in spite of enabling or disabling fifo, read the received data from the receive buffer (scxbuf). when receive fifo is disabled, the buffer full flag scxmod2 is cleared to "0" by this read- ing. in the case of the next data can be received in th e receive shift register befo re reading a data from the receive buffer. the parity bit to be added in the 8-bit uart mode as we ll as the most significant bit in the 9-bit uart mode will be stored in scxcr. when the receive fifo is available, the 9-bit uart mode is prohibited because up to 8-bit data can be stored in fifo. in the 8-bit uart mode, the parity bit is lost but parity error is determined and the result is stored in scxcr. 10.11.3.5wake-up function in the 9-bit uart mode, the slave controller can be operated in the wake-up mode by setting the wake- up function scxmod0 to "1." in this case, the interrupt intrxx will be generated only when scxcr is set to "1."
page 10-34 10. serial channel (sio/uart) 10.11 receive TMPM372FWUG 2013/4/15 10.11.3.6overrun error when fifo is disabled, the overrun error is occurred a nd set overrun flag without completing data read before receiving the next data. when overrun error is occurred, a content of receive buffer and scxcr is not lost, but a content of receive shift register is lost. when fifo is enabled, overrun er ror is occurred and set overrun fl ag by no reading the data before moving the next data into received buff er when fifo is full. in this case, the content of fifo are not lost. in the i/o interface mode with sclk output setting, the clock output automati cally stops, so this flag has no meaning. note: when the mode is changed from i/o interface sclk output mode to the other mode, read scxcr and clear overrun flag.
page 10-35 TMPM372FWUG 2013/4/15 10.12transmission 10.12.1transmission counter the transmit counter is a 4-bit binary counter and is counted by sioclk as in the case of the receive counter. in uart mode, it generates a transmit clock (txdclk) on every 16th clock pulse. figure 10-6 generation of transmission clock 10.12.2transmission control 10.12.2.1i/o interface mode in the sclk output mode with scxcr set to "0 ", each bit of data in the transmit buffer is out- putted to the txd pin on the falling edge of the shift clock outputted from the sclk pin. in the sclk input mode with scxcr set to "1 ", each bit of data in the transmit buffer is output- ted to the txd pin on the rising or falling edge of the sclk input signal according to the scxcr setting. 10.12.2.2uart mode when the transmit data is written in the transmit buffer, data transmission is initiated on the rising edge of the next txdclk and the transmit shift clock signal is also generated. 10.12.3transmit operation 10.12.3.1operation of transmission buffer if double buffering is disabled, the cpu writes data only to transmit shift register and the transmit interrupt inttxx is generated upon completion of data transmission. if double buffering is enabled (including the case the transmit fifo is enabled), data written to the transmit buffer is moved to the transmit shift register. the inttxx interrupt is generated at the same time and the transmit buffer empty flag (scxmod2) is set to "1". this flag indicates that the next transmit data can be written. when the next data is written to the transmit buffer, the flag is cleared to "0". 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 sioclk txdclk
page 10-36 10. serial channel (sio/uart) 10.12 transmission TMPM372FWUG 2013/4/15 figure 10-7 operation of transmission buffer (double-buffer is enabled) 10.12.3.2transmit fifo operation when fifo is enabled, the maximum 5-byte data can be stored using the tr ansmit buffer and fifo. once transmission is enabled, data is transferred to the transmit shift register from the transmit buffer and start transmission. if data exists in the fifo, the da ta is moved to the transmit buffer immediately, and the flag is cleared to "0". note: to use tx fifo buffer, tx fifo must be cleared after setting the sio transfer mode (half duplex/ full duplex) and enabling fifo (scxfcnf = "1"). settings and operations to transmit 4-byte data stream by setting the transfer mode to half duplex are shown as below. after above settings are configured, data transmission can be initiated by writing 5 bytes of data to the transmit buffer and fifo, and setting the scxmod1 bit to "1". when the last transmit data is moved to the transmit buffer, the transmit fifo interrupt is generated. when transmission of the last data is completed, the transmissi on sequence is terminated. once above settings are configured, if the transmissi on is not set as auto disabled, the transmission should lasts by writing transmit data. scxmod1[6:5] = 10 : transfer mode is set to half duplex. scxfcnf[4:0] = 11011 : transmission is automatically disabled if fifo becomes empty. the number of bytes to be used in the receive fifo is the same as the interrupt generation fill level. scxtfc[1:0] = 00 : sets the interrupt generation fill level to "0". scxtfc[7:6] = 11 : clears receive fifo and sets the condition of interrupt generation. scxfcnf[0] = 1 : enable fifo. data 1 transmit buffer scxmod2 transmit interrupt(inttxx) write data  data 2 data 1 transmit shift register
page 10-37 TMPM372FWUG 2013/4/15 10.12.3.3i/o interface mode/transmission by sclk output if sclk is set to generate clock the i/o interface mode, the sclk output automatically stops when all data transmission is completed and underrun error will not occur. the timing of suspension and resume of sclk output is different depending on the buffer and fifo usage. (1) single buffer the sclk output stops each time one frame of data is transferred. handshaking for each data with the other side of communication can be enabled. the sclk output resumes when the next data is written in the buffer. (2) double buffer the sclk output stops upon completion of data transmission of the transmit shift register and the transmit buffer. the sclk output resumes when the next data is written in the buffer. (3) fifo the transmission of all data stor ed in the transmit shift register, transmit buffer and fifo is com- pleted, the sclk output stops. the next data is written, sclk output resumes. if scxfcnf is configured, scxmod0< txe> bit is cleared at the same time as sclk stop and the transmission stops. transmit fifo fourth stage scxmod2 data 5 transmit buffer transmit shift register transmit interrupt(inttxx) scxmod1 third stage second stage first stage data 4 data 3 data 2 data 1 data 5 data 4 data 3 data 2 data 5 data 4 data 3 data 1 data 2 data 3 data 5 data 4 data 5 data 4 data 5
page 10-38 10. serial channel (sio/uart) 10.12 transmission TMPM372FWUG 2013/4/15 10.12.3.4under-run error if the transmit fifo is disabled in the i/o interface sclk input mode an d if no data is set in transmit buffer before the next frame clock input, which occurs upon completion of data transmission from trans- mit shift register, an under-run error occurs and scxcr is set to "1". in the i/o interface mode with sclk output setting, the clock output automati cally stops, so this flag has no meaning. note: before switching the i/o interface sclk output mode to other modes, read the scxcr register and clear the underrun flag.
page 10-39 TMPM372FWUG 2013/4/15 10.13handshake function the function of the handshake is to enable frame-by-frame data transmission by using the cts (clear to send) pin and to prevent overrun errors. this function can be enabled or disabled by scxmod0. when the cts pin is set to "high" level, the current data tran smission can be completed but the next data transmis- sion is suspended until the cts pin returns to the "low" level. however in this case, the inttxx interrupt is gener- ated in the normal timing, the next tran smit data is written in the transmit buffer, and it waits until it is ready to transmit data. note 1: if the cts signal is set to "h" during transmission, the next data transmission is suspended after the current trans- mission is completed.(point "a" in figure 10-9) note 2: data transmission starts on the first falling edge of the txdclk clock after cts is set to "l". (point "b" in figure 10-9) although no rts pin is provided, a handshake control function can easily implemented by assigning one bit of the port for the rts function. by setting the port to "high" level upon completion of da ta reception (in th e receive inter- rupt routine), the transmit side can be requested to suspend data transmission. figure 10-8 h andshake function figure 10-9 cts signal timing txd cts rxd rts (any port) transmit side receive side transmission is suspended during this period. start bit bit 0 txd sioclk data write to transmit buffer or shift register txdclk cts 13 14 15 16 1 2 3 14 15 16 1 2 3 a b
page 10-40 10. serial channel (sio/uart) 10.14 interrupt/error generation timing TMPM372FWUG 2013/4/15 10.14interrupt/erro r generation timing 10.14.1rx interrupts figure 10-10 shows the data flow of receive operation and the route of read. figure 10-10 receive buffer /fifo configuration diagram 10.14.1.1single buffer / double buffer rx interrupts are generated at the time depends on the transfer mode and th e buffer configurations, which are given as follows. note: interrupts are not generated when an overrun error is occurred. 10.14.1.2fifo in use of fifo, receive interrupt is generated on the condition that the followi ng either operation and scxrfc setting are established. ? reception completion of all bits of one frame. ? reading fifo interrupt conditions are decided by the scxrfc settings as described in table 10-11. buffer configurations uart modes io interface modes single buffer ? immediately after the rising / falling edge of the last sclk (rising or falling is determined according to scxcr setting.) double buffer around the center of the first stop bit immediately after the rising / falling edge of the last sclk (rising or falling is determined according to scxcr setting.) on data transfer from the shift register to the buffer by reading buffer. table 10-11 receive interrup t conditions in use of fifo scxrfc interrupt conditions "0" "the fill level of fifo" is equal to "the fill level of fifo interruption generation." "1" "the fill level of fifo" is greater than or equal to "the fill level of fifo intrruption generation." 4:(+(1 6j ghktuvuvcig 6jgugeqpfuvcig 6jgvjktfuvcig 6jghqwtvjuvcig 4gegkxgdwhhgt 4gegkxgujkhvtgikuvgt 4:& +hvjgtgegkxgdwhhgtkugorv[ vjgfcvckuoqxgf +hvjg4:(+(1kupqvhwnn vjgfcvckuoqxgf
 4gcfkpikpvjgukpingdwhhgteqphkiwtcvkqp ??#pkpvgttwrvkuigpgtcvgfchvgttgegkxkpicnndkvu
 4gcfkpikpvjgfqwdngdwhhgteqphkiwtcvkqp ??#pkpvgttwrvkuigpgtcvgfyjgpvjgfcvckuoqxgfvq vjgtgegkxgdwhhgt
 4gcfkpikpwugvjg(+(1 ??#pkpvgttwrvkuigpgtcvgf ???yjgpvjgfcvckuoqxgfvqvjg(+(1 ???qtyjgptgcfkpivjg(+(1
page 10-41 TMPM372FWUG 2013/4/15 10.14.2tx interrupts figure 10-11 shows the data flow of transmit operation and the route of read. figure 10-11 transmit buffer /fifo configuration diagram 10.14.2.1single buffer / double buffer tx interrupts are generated at the time depends on the transfer mode and the buffer configurations, which are given as follows. note: if double buffer is enabled, a interrupt is also generated when the data is moved from the buffer to the shift register by writing to the buffer. 10.14.2.2fifo in use of fifo, transmit interrupt is generated on the condition that the following either operation and scxtfc setting are established. ? transmittion completion of all bits of one frame. ? writing fifo interrupt conditions are decided by the scxtfc settings as described in table 10-12. buffer configurations uart modes io interface modes single buffer just before the stop bit is sent immediately after the rising / falling edge of the last sclk (rising or falling is determined according to scxcr setting.) double buffer when a data is moved from the transmit buffet to the transmit shift register. table 10-12 transmit interrupt conditions in use of fifo scxtfc interrupt conditions "0" "the fill level of fifo" is equal to "the fill level of fifo interruption generation." "1" "the fill level of fifo" is smaller than or equal to "the fill level of fifo interruption genera- tion." 6:(+(1 6j ghktuvuvcig 6jgugeqpfuvcig 6jgvjktfuvcig 6jghqwtvjuvcig 6tcpuokvdwhhgt 6tcpuokvujkhvtgikuvgt 6:& +hvjgujkhvtgikuvgtkugorv[ vjgfcvckuoqxgf +hvjgvtcpuokvdwhhgtkugorv[ vjgfcvckuoqxgf
 9tkvkpikpvjgukpingdwhhgteqphkiwtcvkqp ??#pkpvgttwrvkuigpgtcvgfchvgtvtcpuokvvkpicnndkvu
 9tkvkpikpvjgfqwdngdwhhgteqphkiwtcvkqp ??#pkpvgttwrvkuigpgtcvgfyjgpvjgfcvckuoqxgfvq vjgvtcpuokvujkhvtgikuvgt
 9tkvkpikpwugvjg(+(1 ??#pkpvgttwrvkuigpgtcvgf ???yjgpvjgfcvckuoqxgfvqvjgvtcpuokvdwhhgt ???qtyjgpytkvkpivqvjg(+(1
page 10-42 10. serial channel (sio/uart) 10.15 software reset TMPM372FWUG 2013/4/15 10.14.3error generation 10.14.3.1uart mode 10.14.3.2io interface mode note: over-run error and under-run error have no meaning in sclk output mode. 10.15software reset software reset is generated by writing scxm od2 as "10" followed by "01". as a result, scxmod0, scxmod1, scxmod2, scxcr are initialized. and the receive circuit, the transmit circuit and the fi fo become initial state. other states are held. modes 9 bits 7 bits 8 bits 7 bits + parity 8 bits + parity framing error overrun error around the center of stop bit parity error ? around the center of parity bit overrun error immediately after the rising / falling edge of the last sclk (rising or falling is determined according to scxcr setting.) underrun error immediately after the rising or falling edge of the next sclk. (rising or falling is determined according to scxcr setting.)
page 10-43 TMPM372FWUG 2013/4/15 10.16operation in each mode 10.16.1mode 0 (i/o interface mode) mode 0 consists of two modes, the sclk output mode to output synchronous clock and the sclk input mode to accept synchronous cloc k from an exte rnal source. the following operational descriptions are for the case use of fifo is di sabled. for details of fifo opera- tion, refer to the previous sections describing recei ve/transmit fifo functions. 10.16.1.1transmitting data (1) sclk output mode ? if the transmit double buffer is disabled (scxmod2 = "0") data is output from the txd pin and the cl ock is output from the sclk pin each time the cpu writes data to the transmit buffer. when all data is output, an interrupt (inttxx) is gen- erated. ? if the transmit double buffer is enabled (scxmod2 = "1") data is moved from the transmit buffer to th e transmit shift register when the cpu writes data to the transmit buffer while data transmission is halted or when data transmission from the transmit buffer (shift register) is completed. simultaneously, the transmit buffer empty flag scxmod2 is set to "1", a nd the inttxx interrupt is generated. when data is moved from the transmit buffer to the transmit shift register, if the transmit buffer has no data to be moved to the transmit shift register, inttxx interrupt is not gener- ated and the sclk output stops.
page 10-44 10. serial channel (sio/uart) 10.16 operation in each mode TMPM372FWUG 2013/4/15 figure 10-12 transmit operation in the i/o interface mode (sclk output mode) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk output bit 7 bit 0 = "0" (if double buffering is disabled) bit 0 bit 1 bit 6 txd (inttxx interrupt request) sclk output = "1" (if double buffering is enabled and there is data in buffer) bit 7 bit 0 tbemp bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk output = "1" (if double buffering is enabled and threre is no data in buffer) bit 7 tbemp transmit data write timing
page 10-45 TMPM372FWUG 2013/4/15 (2) sclk input mode ? if double buffering is disabled (scxmod2 = "0") if the sclk is input in the condition where data is written in the transmit buffer, 8-bit data is outputted from the txd pin. when all data is output, an interrupt inttxx is generated. the next transmit data must be written before the timing point "a" as shown in figure 10-13. ? if double buffer is enabled (scxmod2 = "1") data is moved from the transmit buffer to th e transmit shift register when the cpu writes data to the transmit buffer before the sclk input becomes active or when data transmission from the transmit shift register is completed. simultaneously, the tr ansmit buffer empty flag scxmod2 is set to "1", and the inttxx interrupt is generated. if the sclk input becomes activ e while no data is in the transmit buffer, although the internal bit counter is started, an under-run error occurs and 8-bit dummy data (0xff) is sent.
page 10-46 10. serial channel (sio/uart) 10.16 operation in each mode TMPM372FWUG 2013/4/15 figure 10-13 transmit oper ation in the i/o interf ace mode (sclk input mode) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk input (=1 falling edge mode) sclk input (=0 rising edge mode) bit 5 bit 7 bit 1 bit 0 a = "0" (if double buffering is disabled) bit 0 bit 1 bit 6 txd (inttxx interrupt request) sclk input (=1 falling edge mode) sclk input (=0 rising edge mode) bit 5 bit 7 bit 1 bit 0 a = "1" (if double buffering is enabled and there is data in buffer) tbemp bit 0 bit 1 bit 6 txd (inttxx interrupt request)  sclk input (=1 falling edge mode) sclk input (=0 rising edge mode) bit 5 bit 7 a = "1" (if double buffering is enabled and there is no data in buffer) tbemp 1 1 perr (functions to detect under-run errors) transmit data write timing transmit data write timing
page 10-47 TMPM372FWUG 2013/4/15 10.16.1.2receive (1) sclk output mode the sclk output can be star ted by setting the receive enab le bit scxmod0 to "1". ? if double buffer is disabled (scxmod2 = "0") a clock pulse is outputted from the sclk pin a nd the next data is stored into the shift reg- ister each time the cpu reads received data. wh en all the 8 bits are received, the intrxx interrupt is generated. ? if double buffer is enabled (scxmod2 = "1") data stored in the shift register is moved to the receive buffer and the receive buffer can receive the next frame. a data is moved from the shift regist er to the receive buffer, the receive buffer full flag scxmod2 is set to "1" and the intrxx is generated. while data is in the receive buffer, if the data cannot be read from the receive buffer before completing reception of the next 8 bits, the intrxx interrupt is not generated and the sclk output stops. in this state, reading data from the receive buffer al lows data in the shift register to move to the receive buffer and thus the intr xx interrupt is genera ted and data reception resumes.
page 10-48 10. serial channel (sio/uart) 10.16 operation in each mode TMPM372FWUG 2013/4/15 figure 10-14 receive operation in the i/o interface mode (sclk output mode) bit 0 bit 1 bit 6 rxd (intrx interrupt request) 5hfhlyhgdwd uhdgwlplqj sclk output bit 7 bit 0 = "0" (if double buffering is disable g bit 0 bit 1 bit 6 rxd (intrx interrupt request) 5hfhlyhgdwd uhdgwlplqj sclk output bit 0 = "1" (if double buffering is enabled and data is read from buffer) bit 7 bit 7 rbfll bit 0 bit 1 bit 6 rxd (intrx interrupt request) 5hfhlyhgdwd uhdgwlplqj sclk output = "1" (if double buffering is enabled and data cannot be read from buffer) bit 7 bit 7 rbfll
page 10-49 TMPM372FWUG 2013/4/15 (2) sclk input mode in the sclk input mode, receiving double bufferin g is always enabled, the received frame can be moved to the receive buffer from the shift register, and the receive buffer can receive the next frame successively. the intrxx receive interrupt is generated each ti me received data is moved to the receive buffer. figure 10-15 receive operation in the i/o interface mode (sclk input mode) bit 0 bit 1 bit 6 rxd (intrxx interrupt request) receive data read timing sclk input (=1 falling mode) sclk input (=0 rising mode) bit 5 bit 7 bit 0 if data is read from buffer rbfll bit 0 bit 1 bit 6 rxd (intrxx interrupt request) receive data read timing sclk input (=1 falling mode) sclk input (=0 rising mode) bit 5 bit 7 bit 0 if data cannot be read from buffer rbfll oerr
page 10-50 10. serial channel (sio/uart) 10.16 operation in each mode TMPM372FWUG 2013/4/15 10.16.1.3transmit and receive (full-duplex) (1) sclk output mode ? if scxmod2 is set to "0" and the double buffers are disabled sclk is outputted when the cpu writes data to the transmit buffer. subsequently, 8 bits of data are shifted into receive shift register and the intrxx receive interrupt is generated. concurre ntly, 8 bits of data written to the transmit buffer are outputted from the txd pin, the inttxx transmit interrupt is generated when transmission of all data bits has been completed. then, the sclk output stops. the next round of data transmission and recepti on starts when the data is read from the receive buffer and the next transmit data is wr itten to the transmit bu ffer by the cpu. the order of reading the receive buf fer and writing to the transmit buffer can be freely deter- mined. data transmission is resumed only when both conditions are satisfied. ? if scxmod2 is set to "1" and the double buffers are enabled sclk is outputted when the cpu writes data to the transmit buffer. 8 bits of data are shifted into the receive shift regi ster, moved to the receive buffer, and the intrxx interrupt is generated. while 8 bits of da ta is received, 8 bits of transmit data is out- putted from the txd pin. when all data bits are sent out, the inttxx interrupt is generated and the next data is moved from the tran smit buffer to the transmit shift register. if the transmit buffer has no data to be moved to the transmit buffer (scxmod2 = 1) or when the receive bu ffer is full (scxmod2 = 1), the sclk output is stopped. when both conditions , receive data is read and transmit data is written, are satisfied, the sclk output is resumed and the next round of data transmission and reception is started.
page 10-51 TMPM372FWUG 2013/4/15 figure 10-16 transmit/receive operation in the i/o interf ace mode (sclk output mode) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk output bit 5 bit 7 bit 1 bit 0 = "0" (if double buffering is disabled) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk output bit 5 bit 7 bit 1 bit 0 = "1" (if double buffering is enabled) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk output bit 5 bit 7 = "1" (if double buffering is enabled) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 (intrxx interrupt request)
page 10-52 10. serial channel (sio/uart) 10.16 operation in each mode TMPM372FWUG 2013/4/15 (2) sclk input mode ? if scxmod2 is set to "0" and the transmit double buffer is disabled when receiving data, double buffer is al ways enabled regardless of the scxmod2 settings. 8-bit data written in the transmit buffer is outputted from the txd pin and 8 bit of data is shifted into the receive buffer when the sclk input becomes active.the inttxx interrupt is generated upon completion of data transmission. the intrxx interrupt is generated when the data is moved from receive shift register to receive buffer after completion of data recep- tion. note that transmit data must be written into the transmit buffer before the sclk input for the next frame (data must be written before the point a in figure 10-17). data must be read before completing reception of the next frame data. ? if scxmod2 is set to "1" and the double buffer is enabled. the interrupt inttxx is generated at the timi ng the transmit buffer data is moved to the transmit shift register after completing data tr ansmission from the tran smit shift register. at the same time, data received is shifted to the shift register, it is moved to the receive buffer, and the intrxx interrupt is generated. note that transmit data must be written into the transmit buffer before the sclk input for the next frame (data must be written before the point a in figure 10-17). data must be read before completing reception of the next frame data. upon the sclk input for the next frame, transmission from transmit shift register (in which data has been moved from transmit buffer) is started while receive data is shifted into receive shift regist er simultaneously. if data in receive buffer has not been read wh en the last bit of th e frame is received, an overrun error occurs. similarly, if there is no data written to transmit buffer when sclk for the next frame is input, an under-run error occurs.
page 10-53 TMPM372FWUG 2013/4/15 figure 10-17 transmit/receiv e operation in the i/o inte rface mode (sclk input mode) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk input bit 5 bit 7 bit 1 bit 0 a = "0" (if double buffering is disabled) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk input bit 5 bit 7 bit 1 bit 0 = "1" (if double buffering is enabled with no errors) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) bit 0 bit 1 bit 6 txd (inttxx interrupt request) transmit data write timing sclk input bit 5 bit 7 bit 1 bit 0 = "1" (if double buffering is enabled with error generation) receive data read timing bit 0 bit 1 bit 6 rxd bit 5 bit 7 bit 1 bit 0 (intrxx interrupt request) perr(under-run errors) a a
page 10-54 10. serial channel (sio/uart) 10.16 operation in each mode TMPM372FWUG 2013/4/15 10.16.2mode 1 (7 -bit uart mode) the 7-bit uart mode can be selected by setting th e mode control register (scxmod) to "01". in this mode, parity bits can be added to the transmit data stream; the control register (scxcr) controls the parity enable/disable setting. when is set to "1" (enable), either even or odd parity may be selected using the scxcr bit. the length of the stop bit can be specified using scxmod2. the following table shows the control register settings for transmitting in the following data format. 10.16.3mode 2 (8 -bit uart mode) the 8-bit uart mode can be selected by setting scxmod0 to "10." in this mode, parity bits can be added and parity enable/disable is controlled using scxcr. if = "1" (enabled), either even or odd parity can be selected using scxcr. the control register settings for receiving data in the foll owing format are as follows: clocking condi- tions system clock : high-speed (fc) high-speed clock gear: 1 (fc) prescaler clock: fperiph/2 (fperiph = fsys) 76543210 scxmod0 x0 - 00101 set 7-bit uart mode scxcr x 1 1 x x x 0 0 even parity enabled scxbrcr 00100100 set 2400bps scxbuf ******** set transmit data x : don?t care - : no change clocking condi- tions system clock: high-speed (fc) high-speed clock gear: 1 (fc) prescaler clock: fperiph/2 (fperiph = fsys) stop start bit 0 1 2 3 4 5 6 even parity transmission direction (transmission rate of 2400bps @fc = 9.8304 mhz) stop start bit 0 1 2 3 4 5 6 7 odd parity recetion direction (reception rate of 9600 bps @fc = 9.8304 mhz)
page 10-55 TMPM372FWUG 2013/4/15 10.16.4mode 3 (9 -bit uart mode) the 9-bit uart mode can be selected by setting sc xmod0 to "11." in this mode, parity bits must be disabled (scxcr = "0"). the most significant bit (9th bit) is written to scxmod0 for transmitting data. the data is stored in scxcr. when writing or reading data to/from the buffers, the most significant bit must be written or read first before writing or reading to/from scxbuf. the stop bit length can be specified using scxmod2. 10.16.4.1wake up function in the 9-bit uart mode, slave controllers can be operated in the wake-up mode by setting the wake-up function control bit scxmod0 to "1." in this case, the interrupt intrxx will be generated only when scxcr is set to "1". note: the txd pin of the slave controller must be set to the open drain output mode using the pxod register. figure 10-18 serial lin ks to use wake-up function 76543210 scxmod0 x0001001 set 8-bit uart mode scxcr x 0 1 x x x 0 0 odd parity enabled scxbrcr 00010100 set 9600bps scxmod0 --1----- reception e nabled x : don?t care - : no change txd rxd master txd rxd slave1 txd rxd slave2 txd rxd slave3
page 10-56 10. serial channel (sio/uart) 10.16 operation in each mode TMPM372FWUG 2013/4/15 10.16.4.2protocol 1. select the 9-bit uart mode for the master and slave controllers. 2. set scxmod0 to "1" for th e slave controllers to make them ready to receive data. 3. the master controller is to tran smit a single frame of data that in cludes the slave controller select code (8 bits). in this, the most significant bit (bit 8) must be set to "1". 4. each slave controller receives the above data fr ame; if the code receive d matches with the con- troller's own select code, it clears the wu bit to "0". 5. the master controller transmits data to the desi gnated slave controller (the controller of which scxmod bit is cleared to "0"). in this, the most significant bit (bit 8) must be set to "0". 6. the slave controllers w ith the bit set to "1" ignore th e receive data because the most sig- nificant bit (bit 8) is set to "0" and thus no interrupt (intrxx) is generated.also, the slave controller with the bit set to "0" can transmit data to the master controller to inform that the data has been successfully received. stop start bit 0 1 2 3 4 5 6 78 select code of the slave controller "1" stop start bit 0 1 2 3 4 5 6 7 bit 8 data "0"
page 11-1 TMPM372FWUG 2013/4/15 11. 12-bit analog-to-digital converters the TMPM372FWUG contains two 12-bit successive-a pproximation analog-to-digital converters (adcs). the adc unit b (adc b) has 11 analog inputs. three inputs ar e able to use for shunt resi stor currents of motor 0. and an input is able to use for shunt resistor currents of motor 1. thus eight inputs can use for external input. external analog input pins (ainb2, ainb3 to ainb12) can also be used as input/output ports. 11.1 functions and features 1. it can select analog input and st art ad conversion when receiving trig ger signal from pmd or tmrb(inter- rupt). 2. it can select analog input, in the software trigger program and the constant trigger program. 3. the adcs has twelve register for ad conversion result. 4. the adcs generate interrupt signal at the end of the program which was started by pmd trigger and tmrb trigger. 5. the adcs generate interrupt signal at the end of the program which are the software trigger program and the constant trigger program. 6. the adcs have the ad conversion monitoring function. when this function is enabled, an interrupt is gen- erated when a conversion result matches the specified comparison value. 11.2 block diagram figure 11-1 ad converters block diagram ainb2 ainb3 adc b ainb4 ainb5 pi3(ainb2) ainb6 pj1(ainb4) avdd5b/vrefhb avssb/vreflb cpu ve pmd1 trg0 to 5 intadbpdb pmd1 ovv intadbsft intadbtmr intadbcpb pj0(ainb3) ainb7 ainb8 ainb9 ainb10 ainb11 ainb12 pj2(ainb5) pj3(ainb6) pj4(ainb7) pj5(ainb8) pj6(ainb9) pj7(ainb10) pk0(ainb11) pk1(ainb12)
page 11-2 11. 12-bit analog-to-digital converters 11.3 list of registers TMPM372FWUG 2013/4/15 11.3 list of registers unit x base address unit b 0x4003_0200 register name(x=a,b) address(base+) clock setting register adbclk 0x0000 mode setting register 0 adbmod0 0x0004 mode setting register 1 adbmod1 0x0008 mode setting register 2 adbmod2 0x000c monitoring setting register 0 adbcmpcr0 0x0010 monitoring setting register 1 adbcmpcr1 0x0014 conversion result compare register 0 adbcmp0 0x0018 conversion result compare register 1 adbcmp1 0x001c conversion result register 0 adbreg0 0x0020 conversion result register 1 adbreg1 0x0024 conversion result register 2 adbreg2 0x0028 conversion result register 3 adbreg3 0x002c conversion result register 4 adbreg4 0x0030 conversion result register 5 adbreg5 0x0034 conversion result register 6 adbreg6 0x0038 conversion result register 7 adbreg7 0x003c conversion result register 8 adbreg8 0x0040 conversion result register 9 adbreg9 0x0044 conversion result register 10 adbreg10 0x0048 conversion result register 11 adbreg11 0x004c reserved b ? 0x0050 reserved b ? 0x0054 reserved b ? 0x0058 reserved b ? 0x005c reserved b ? 0x0060 reserved b ? 0x0064 pmd trigger program number select register 6 adbpsel6 0x0068 pmd trigger program number select register 7 adbpsel7 0x006c pmd trigger program number select register 8 adbpsel8 0x0070 pmd trigger program number select register 9 adbpsel9 0x0074 pmd trigger program number select register 10 adbpsel10 0x0078 pmd trigger program number select register 11 adbpsel11 0x007c pmd trigger interrupt select register 0 adbpints0 0x0080 pmd trigger interrupt select register 1 adbpints1 0x0084
page 11-3 TMPM372FWUG 2013/4/15 note: do not access to "reserved" address. pmd trigger interrupt select register 2 adbpints2 0x0088 pmd trigger interrupt select register 3 adbpints3 0x008c pmd trigger interrupt select register 4 adbpints4 0x0090 pmd trigger interrupt select register 5 adbpints5 0x0094 pmd trigger program register 0 adbpset0 0x0098 pmd trigger program register 1 adbpset1 0x009c pmd trigger program register 2 adbpset2 0x00a0 pmd trigger program register 3 adbpset3 0x00a4 pmd trigger program register 4 adbpset4 0x00a8 pmd trigger program register 5 adbpset5 0x00ac timer trigger program registers 0 to 3 adbtset03 0x00b0 timer trigger program registers 4 to 7 adbtset47 0x00b4 timer trigger program registers 8 to 11 adbtset811 0x00b8 software trigger program registers 0 to 3 adbsset03 0x00bc software trigger program registers 4 to 7 adbsset47 0x00c0 software trigger program registers 8 to 11 adbsset811 0x00c4 constant conversion program registers0 to 3 adbaset03 0x00c8 constant conversion program re gisters 4 to 7 adbaset47 0x00cc constant conversion program registers 8 to 11 adbaset811 0x00d0 reserved ? 0x00d4 register name(x=a,b) address(base+)
page 11-4 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4 register descriptions ad conversion is performed at the clock freque ncy selected in the adc clock setting register. 11.4.1 adbclk (clo ck setting register) note 1: frequency of sclk can be use up to 40mhz. do not set to "000" when fc > 40mhz. note 2: ad conversion is performed at the clock frequency selected in this register. the conversion clock frequency must be selected to ensure the guaranteed accuracy. note 3: the conversion clock must not be changed while ad conversion is in progress. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - tsh adclk after reset01011000 bit bit symbol type function 31-7 ? r read as "0". 6-3 tsh[3:0] r/w write as "1001". 2-0 adclk[2:0] r/w ad prescaler output (sclk) select 000: fc (note1) 001: fc/2 010: fc/4 011: fc/8 1xx: fc/16 1 16 8 4 2 fc sclk 000 1xx 001 010 100
page 11-5 TMPM372FWUG 2013/4/15 11.4.2 adbmod0 (mode setting register 0) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------daconadss after reset00000000 bit bit symbol type function 31-2 ? r read as "0". 1 dacon r/w dac control 0: off 1: on setting to "1", when using the adc. 0 adss w software triggered conversion 0: don't care 1: start setting to "1" starts ad conv ersion (software triggered conversion ). receiving trigger signal from pmd or tmrb(interrupt) starts ad conversion also. for detail setting, please read the chapter about pmd and tmrb.
page 11-6 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.3 adbmod1 (mode setting register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symboladen------adas after reset00000000 bit bit symbol type function 31-8 ? r read as "0". 7 aden r/w ad conversion control 0: disable 1: enable setting to "1", when using the adc. after sett ing to "1", setting to "1" starts ad conversion and repeat conversion. 6-1 ? r read as "0". 0 adas r/w constant ad conversion control 0: disable 1: enable
page 11-7 TMPM372FWUG 2013/4/15 11.4.4 adbmod2 (mode setting register 2) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------adsfnadbfn after reset00000000 bit bit symbol type function 31-2 ? r read as "0". 1 adsfn r software conversion busy flag 0: conversion completed 1: conversion in progress the is a software ad conversion busy flag. after was set to "1", when ad conversion is actually started, is set to "1". when finished ad conversion, is cleared to "0". 0 adbfn r ad conversion busy flag 0: conversion not in progress 1: conversion in progress the is an ad conversion busy flag. when ad conversion is started regardless of conversion factor (pmd, timer, software, constant), is set to "1". when finished ad conversion, is cleared to "0".
page 11-8 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.5 adbcmpcr0(monitori ng setting register 0) after fixing the conversion result, the interrupt signal (intadbcpn) is generated. note:the adbcmpcr0 and adbcmpcr1 registers are used to enable or disable comparison between an ad conversion result and the specified comparison value, to select the register to be compared with an ad con- version result and to set how many times comparison should be performed to determine the result. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol---- cmpcnt0 after reset00000000 7 6 5 4 3 2 1 0 bit symbol cmp0en - - adbig0 regs0 after reset00000000 bit bit symbol type function 31-12 - r read as "0". 11-8 cmpcnt0[3:0] r/w comparison count for determining the result 0: after every comparison 1: after two comparisons ? ? 15: after 16 comparisons 7 cmp0en r/w monitoring function 0:disable 1:enable 6-5 - r read as "0". 4 adbig0 r/w comparison condition 0:larger than or equal to compare register 1:smaller than or equal to compare register 3-0 regs0[3:0] r/w ad conversion result register to be compared 0000: adbreg0 0100: adbreg4 1000: adbreg8 0001: adbreg1 0101: adbreg5 1001: adbreg9 0010: adbreg2 0110: adbreg6 1010: adbreg10 0011: adbreg3 0111: adbreg7 1011: adbreg11
page 11-9 TMPM372FWUG 2013/4/15 11.4.6 adbcmpcr1(monitori ng setting register 1) after fixing the conversion result, the interrupt signal (intadbcpn) is generated.(n=a,b / a:monitor0 / b:monitor1) note:the adbcmpcr0 and adbcmpcr1 registers are used to enable or disable comparison between an ad conversion result and the specified comparison value, to select the register to be compared with an ad con- version result and to set how many times comparison should be performed to determine the result. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol---- cmpcnt1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol cmp1en - - adbig1 regs1 after reset00000000 bit bit symbol type function 31-12 - r read as "0". 11-8 cmpcnt1[3:0] r/w comparison count for determining the result 0: after every comparison 1: after two comparisons ? ? 15: after 16 comparisons 7 cmp1en r/w monitoring function 0:disable 1:enable 6-5 - r read as "0". 4 adbig1 r/w comparison condition 0:larger than or equal to compare register 1:smaller than or equal to compare register 3-0 regs1[3:0] r/w ad conversion result register to be compared 0000: adbreg0 0100: adbreg4 1000: adbreg8 0001: adbreg1 0101: adbreg5 1001: adbreg9 0010: adbreg2 0110: adbreg6 1010: adbreg10 0011: adbreg3 0111: adbreg7 1011: adbreg11
page 11-10 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.7 adbcmp0(conversion re sult compare register 0) 11.4.8 adbcmp1(conversion re sult compare register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol ad0cmp0 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ad0cmp0 ---- after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 ad0cmp0[11:0] r/w the value to be compared with an ad conversion result specify the value to be compared with an ad conversion result. 3-0 - r read as "0". 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol ad0cmp1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ad0cmp1 ---- after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 ad0cmp1[11:0] r/w the value to be compared with an ad conversion result specify the value to be compared with an ad conversion result. 3-0 - r read as "0".
page 11-11 TMPM372FWUG 2013/4/15 11.4.9 adbreg0(conversi on result register 0) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr0 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr0 - - ovr0 adr0rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr0[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr0 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg0 is read and is cleared when the low-order byte of adbreg0 is read. 0 adr0rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg0 register and is cleared when the low-order byte of adbreg0 is read.
page 11-12 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.10adbreg1(convers ion result register 1) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr1 - - ovr1 adr1rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr1[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr1 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg1 is read and is cleared when the low-order byte of adbreg1 is read. 0 adr1rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg1 register and is cleared when the low-order byte of adbreg1 is read.
page 11-13 TMPM372FWUG 2013/4/15 11.4.11adbreg2(convers ion result register 2) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr2 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr2 - - ovr2 adr2rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr2[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr2 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg2 is read and is cleared when the low-order byte of adbreg2 is read. 0 adr2rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg2 register and is cleared when the low-order byte of adbreg2 is read.
page 11-14 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.12adbreg3(convers ion result register 3) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr3 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr3 - - ovr3 adr3rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr3[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr3 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg3 is read and is cleared when the low-order byte of adbreg3 is read. 0 adr3rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg3 register and is cleared when the low-order byte of adbreg3 is read.
page 11-15 TMPM372FWUG 2013/4/15 11.4.13adbreg4(convers ion result register 4) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr4 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr4 - - ovr4 adr4rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr4[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr4 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg4 is read and is cleared when the low-order byte of adbreg4 is read. 0 adr4rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg4 register and is cleared when the low-order byte of adbreg4 is read.
page 11-16 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.14adbreg5(convers ion result register 5) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr5 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr5 - - ovr5 adr5rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr5[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr5 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg5 is read and is cleared when the low-order byte of adbreg5 is read. 0 adr5rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg5 register and is cleared when the low-order byte of adbreg5 is read.
page 11-17 TMPM372FWUG 2013/4/15 11.4.15adbreg6(convers ion result register 6) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr6 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr6 - - ovr6 adr6rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr6[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr6 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg6 is read and is cleared when the low-order byte of adbreg6 is read. 0 adr6rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg6 register and is cleared when the low-order byte of adbreg6 is read.
page 11-18 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.16adbreg7(convers ion result register 7) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr7 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr7 - - ovr7 adr7rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr7[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr7 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg7 is read and is cleared when the low-order byte of adbreg7 is read. 0 adr7rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg7 register and is cleared when the low-order byte of adbreg7 is read.
page 11-19 TMPM372FWUG 2013/4/15 11.4.17adbreg8(convers ion result register 8) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr8 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr8 - - ovr8 adr8rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr8[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr8 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg8 is read and is cleared when the low-order byte of adbreg8 is read. 0 adr8rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg8 register and is cleared when the low-order byte of adbreg8 is read.
page 11-20 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.18adbreg9(convers ion result register 9) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr9 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr9 - - ovr9 adr9rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr9[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr9 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg9 is read and is cleared when the low-order byte of adbreg9 is read. 0 adr9rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg9 register and is cleared when the low-order byte of adbreg9 is read.
page 11-21 TMPM372FWUG 2013/4/15 11.4.19adbreg10(conversi on result register 10) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr10 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr10 - - ovr10 adr10rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr10[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr10 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conversion result is stored before t he value of adbreg10 is read and is cleared when the low-order byte of adbreg10 is read. 0 adr10rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversi on result is stored in the adbreg10 register and is cleared when the low-order byte of adbreg10 is read.
page 11-22 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.20adbreg11(conversi on result register 11) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol adr11 after reset00000000 7 6 5 4 3 2 1 0 bit symbol adr11 - - ovr11 adr11rf after reset00000000 bit bit symbol type function 31-16 - r read as "0". 15-4 adr11[11:0] r the value of an ad conversion result 3-2 - r read as "0". 1 ovr11 r overrun flag 0:no overrun occurred 1:overrun occurred this flag is set when a new ad conv ersion result is stored before the value of adbreg11 is read and is cleared when the low-order byte of adbreg11 is read. 0 adr11rf r ad conversion result store flag 0:no result stored 1:result stored is a flag that is set when an ad conversion result is stored in the adbreg11 register and is cleared when the low-order byte of adbreg11 is read.
page 11-23 TMPM372FWUG 2013/4/15 11.4.21pmd trigger program registers ad conversion can be started by a trigger from the pmd (programmable motor driver). the pmd trigger program registers are used to specify the program to be started by each of six triggers gen- erated by the pmd, to select the interrupt to be generated upon completion of the program and to select the ain input to be used. the pmd trigger program registers include three types of registers. ? pmd trigger program number select register (adbpsel0 to adbpsel11) the pmd trigger program number select regi ster (adbpseln) specifies the program to be started by each of six ad conver sion start signals corresponding to six triggers(pmd1trg0 to 5) generated by the pmd. prog rams 0 to 5 are available. "adbpsel6 to adbpsel11" corr esponds to "pmd1trg0 to 5". ? pmd trigger interrupt select re gister (adbpints0 to adbpints5) the pmd trigger interrupt select registers (adb pints0 to adbpints5) select the interrupt to be generated upon completion of each program, and enables or disables the interrupt. adbpints0 corresponds to program 0, a nd it exists to adbpint5 (program 5). ? pmd trigger program register (adbpset0 to adbpset5) the pmd trigger program setting registers (adb pset0 to adbpset5) specify the settings for each of programs 0 to 5. each pmd trigger program register is comprised of four registers for spec- ifying the ain input to be converted. the conv ersion results corresponding to the adbpsetn0 to adbpsetn3 registers are stored in the conversion result re gisters 0 to 3 (adbreg0 to adbreg3). figure 11-2 pmd tri gger program registers pmd trigger program number select registers (adbpsel6vq adbpsel11) pmd trigger signal (ad conversion start signals) adbpsel6 adbpsel8 adbpsel7 adbpsel10 adbpsel11 adbpsel9 pmd1trg0 pmd1trg2 pmd1trg1 pmd1trg4 pmd1trg5 pmd1trg3 pmd trigger interrupt setting registers (adbpints0vqadbpints5) pmd trigger program setting registers (adbpset0vqadxpset5) conversion result register0 : adbreg0 conversion result register3 : adbreg3 conversion result register2 : adbreg2 conversion result register1 : adbreg1 program 0 adbpints0 adbpset0 reg0 reg1 reg2 reg3 program 3 adbpints3 adbpset3 reg0 reg1 reg2 reg3 program 4 adbpints4 adbpset4 reg0 reg1 reg2 reg3 program 5 adbpints5 adbpset5 reg0 reg1 reg2 reg3 program 2 adbpints2 adbpset2 reg0 reg1 reg2 reg3 program 1 adbpints1 adbpset1 reg0 reg1 reg2 reg3 the starting program is selected.
page 11-24 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.21.1adbpsel6 to adbpsel11(pmd trigger program number select register 6 to 11) adbpsel0:pmd trigger program number select register 0 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens0---- pmds0 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens0 r/w pmd0trg0 trigger controll 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds0[2:0] r/w program number select (refer to table 11-1) adbpsel1:pmd trigger program number select register 1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens1---- pmds1 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens1 r/w pmd0trg1 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds1[2:0] r/w program number select (refer to table 11-1)
page 11-25 TMPM372FWUG 2013/4/15 adbpsel2:pmd trigger program number select register 2 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens2---- pmds2 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens2 r/w pmd0trg2 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds2[2:0] r/w program number select (refer to table 11-1) adbpsel3:pmd trigger program number select register 3 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens3---- pmds3 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens3 r/w pmd0trg3 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds3[2:0] r/w program number select (refer to table 11-1)
page 11-26 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbpsel4:pmd trigger program number select register 4 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens4---- pmds4 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens4 r/w pmd0trg4 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds4[2:0] r/w program number select (refer to table 11-1) adbpsel5:pmd trigger program number select register 5 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens5---- pmds5 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens5 r/w pmd0trg5 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds5[2:0] r/w program number select (refer to table 11-1)
page 11-27 TMPM372FWUG 2013/4/15 adbpsel6:pmd trigger program number select register 6 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens6---- pmds6 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens6 r/w pmd1trg0 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds6[2:0] r/w program number select (refer to table 11-1) adbpsel7:pmd trigger program number select register 7 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens7---- pmds7 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens7 r/w pmd1trg1 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds7[2:0] r/w program number select (refer to table 11-1)
page 11-28 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbpsel8:pmd trigger program number select register 8 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens8---- pmds8 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens8 r/w pmd1trg2 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds8[2:0] r/w program number select (refer to table 11-1) adbpsel9:pmd trigger program number select register 9 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens9---- pmds9 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens9 r/w pmd1trg3 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds9[2:0] r/w program number select (refer to table 11-1)
page 11-29 TMPM372FWUG 2013/4/15 adbpsel10:pmd trigger program number select register 10 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens10---- pmds10 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens10 r/w pmd1trg4 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds10[2:0] r/w program number select (refer to table 11-1) adbpsel11:pmd trigger program number select register 11 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbolpens11---- pmds11 after reset00000000 bit bit symbol type function 31-8 - r read as "0". 7 pens11 r/w pmd1trg5 trigger control 0:disable 1:enable 6-3 - r read as "0". 2-0 pmds11[2:0] r/w program number select (refer to table 11-1)
page 11-30 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 table 11-1 program number select ~ 000 program0 001 program1 010 program2 011 program3 100 program4 101 program5 110 reserved 111 reserved
page 11-31 TMPM372FWUG 2013/4/15 11.4.21.2adbpints0 to 5(pmd trigger interrupt select register 0 to 5) adbpints0:pmd trigger interrupt select register 0 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------ intsel0 after reset00000000 bit bit symbol type function 31-2 - r read as "0". 1-0 intsel0[1:0] r/w interrupt select 00:no interrupt output 01:reserved 10:intadbpdb 11: no interrupt output the starting interrupt is selected for program 0. adbpints1:pmd trigger interrupt select register 1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------ intsel1 after reset00000000 bit bit symbol type function 31-2 - r read as "0". 1-0 intsel1[1:0] r/w interrupt select 00:no interrupt output 01:reserved 10:intadbpdb 11: no interrupt output the starting interrupt is selected for program 1.
page 11-32 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbpints2:pmd trigger interrupt select register 2 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------ intsel2 after reset00000000 bit bit symbol type function 31-2 - r read as "0". 1-0 intsel2[1:0] r/w interrupt select 00:no interrupt output 01:reserved 10:intadbpdb 11: no interrupt output the starting interrupt is selected for program 2. adbpints3:pmd trigger interrupt select register 3 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------ intsel3 after reset00000000 bit bit symbol type function 31-2 - r read as "0". 1-0 intsel3[1:0] r/w interrupt select 00:no interrupt output 01:reserved 10:intadbpdb 11: no interrupt output the starting interrupt is selected for program 3.
page 11-33 TMPM372FWUG 2013/4/15 adbpints4:pmd trigger interrupt select register 4 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------ intsel4 after reset00000000 bit bit symbol type function 31-2 - r read as "0". 1-0 intsel4[1:0] r/w interrupt select 00:no interrupt output 01:reserved 10:intadbpdb 11: no interrupt output the starting interrupt is selected for program 4. adbpints5:pmd trigger interrupt select register 5 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------ intsel5 after reset00000000 bit bit symbol type function 31-2 - r read as "0". 1-0 intsel5[1:0] r/w interrupt select 00:no interrupt output 01:reserved 10:intadbpdb 11: no interrupt output the starting interrupt is selected for program 5.
page 11-34 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 11.4.21.3adbpset0 to 5(pmd trigger program register 0 to 5) each adbpsetn (n=0 to 5:program number) is composed of four sets that assume , , and in a couple. (m=0 to 3) adbregm m=0 m=1 m=2 m=3 adbpsetn n=0 n=1 n=2 n=3 n=4 n=5 table 11-2 select the ain pin to adc unit b 0_0000 :reserved 0_0001 :reserved 0_0010 :ainb2 0_0011 :ainb3 0_0100 :ainb4 0_0101 :ainb5 0_0110 :ainb6 0_0111 :ainb7 0_1000 :ainb8 0_1001 :ainb9 0_1010 :aina10 0_1011 :ainb11 0_1100 :ainb12 0_1101 to 1_1111 :reserved
page 11-35 TMPM372FWUG 2013/4/15 adbpset0:pmd trigger program register 0 31 30 29 28 27 26 25 24 bit symbol ensp03 uvwis03 ainsp03 after reset00000000 23 22 21 20 19 18 17 16 bit symbol ensp02 uvwis02 ainsp02 after reset00000000 15 14 13 12 11 10 9 8 bit symbol ensp01 uvwis01 ainsp01 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ensp00 uvwis00 ainsp00 after reset00000000 bit bit symbol type function 31 ensp03 r/w adbreg3 enable 0:disable 1:enable 30-29 uvwis03[1:0] r/w phase select (for vector engine) see table below. 28-24 ainsp03[4:0] r/w ain select refer to table 11-2 . 23 ensp02 r/w adbreg2 enable 0:disable 1:enable 22-21 uvwis02[1:0] r/w phase select (for vector engine) see table below. 20-16 ainsp02[4:0] r/w ain select refer to table 11-2 . 15 ensp01 r/w adbreg1 enable 0:disable 1:enable 14-13 uvwis01[1:0] r/w phase select (for vector engine) see table below. 12-8 ainsp01[4:0] r/w ain select refer to table 11-2 . 7 ensp00 r/w adbreg0 enable 0:disable 1:enable 6-5 uvwis00[1:0] r/w phase select (for vector engine) see table below. 4-0 ainsp00[4:0] r/w ain select refer to table 11-2 . phase select 00 not specified 01 u 10 v 11 w
page 11-36 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbpset1:pmd trigger program register 1 31 30 29 28 27 26 25 24 bit symbol ensp13 uvwis13 ainsp13 after reset00000000 23 22 21 20 19 18 17 16 bit symbol ensp12 uvwis12 ainsp12 after reset00000000 15 14 13 12 11 10 9 8 bit symbol ensp11 uvwis11 ainsp11 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ensp10 uvwis10 ainsp10 after reset00000000 bit bit symbol type function 31 ensp13 r/w adbreg3 enable 0:disable 1:enable 30-29 uvwis13[1:0] r/w phase select (for vector engine) see table below. 28-24 ainsp13[4:0] r/w ain select refer to table 11-2 . 23 ensp12 r/w adbreg2 enable 0:disable 1:enable 22-21 uvwis12[1:0] r/w phase select (for vector engine) see table below. 20-16 ainsp12[4:0] r/w ain select refer to table 11-2 . 15 ensp11 r/w adbreg1 enable 0:disable 1:enable 14-13 uvwis11[1:0] r/w phase select (for vector engine) see table below. 12-8 ainsp11[4:0] r/w ain select refer to table 11-2 . 7 ensp10 r/w adbreg0 enable 0:disable 1:enable 6-5 uvwis10[1:0] r/w phase select (for vector engine) see table below. 4-0 ainsp10[4:0] r/w ain select refer to table 11-2 . phase select 00 not specified 01 u 10 v 11 w
page 11-37 TMPM372FWUG 2013/4/15 adbpset2:pmd trigger program register 2 31 30 29 28 27 26 25 24 bit symbol ensp23 uvwis23 ainsp23 after reset00000000 23 22 21 20 19 18 17 16 bit symbol ensp22 uvwis22 ainsp22 after reset00000000 15 14 13 12 11 10 9 8 bit symbol ensp21 uvwis21 ainsp21 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ensp20 uvwis20 ainsp20 after reset00000000 bit bit symbol type function 31 ensp23 r/w adbreg3 enable 0:disable 1:enable 30-29 uvwis23[1:0] r/w phase select (for vector engine) see table below. 28-24 ainsp23[4:0] r/w ain select refer to table 11-2 . 23 ensp22 r/w adbreg2 enable 0:disable 1:enable 22-21 uvwis22[1:0] r/w phase select (for vector engine) see table below. 20-16 ainsp22[4:0] r/w ain select refer to table 11-2 . 15 ensp21 r/w adbreg1 enable 0:disable 1:enable 14-13 uvwis21[1:0] r/w phase select (for vector engine) see table below. 12-8 ainsp21[4:0] r/w ain select refer to table 11-2 . 7 ensp20 r/w adbreg0 enable 0:disable 1:enable 6-5 uvwis20[1:0] r/w phase select (for vector engine) see table below. 4-0 ainsp20[4:0] r/w ain select refer to table 11-2 . phase select 00 not specified 01 u 10 v 11 w
page 11-38 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbpset3:pmd trigger program register 3 31 30 29 28 27 26 25 24 bit symbol ensp33 uvwis33 ainsp33 after reset00000000 23 22 21 20 19 18 17 16 bit symbol ensp32 uvwis32 ainsp32 after reset00000000 15 14 13 12 11 10 9 8 bit symbol ensp31 uvwis31 ainsp31 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ensp30 uvwis30 ainsp30 after reset00000000 bit bit symbol type function 31 ensp33 r/w adbreg3 enable 0:disable 1:enable 30-29 uvwis33[1:0] r/w phase select (for vector engine) see table below. 28-24 ainsp33[4:0] r/w ain select refer to table 11-2 . 23 ensp32 r/w adbreg2 enable 0:disable 1:enable 22-21 uvwis32[1:0] r/w phase select (for vector engine) see table below. 20-16 ainsp32[4:0] r/w ain select refer to table 11-2 . 15 ensp31 r/w adbreg1 enable 0:disable 1:enable 14-13 uvwis31[1:0] r/w phase select (for vector engine) see table below. 12-8 ainsp31[4:0] r/w ain select refer to table 11-2 . 7 ensp30 r/w adbreg0 enable 0:disable 1:enable 6-5 uvwis30[1:0] r/w phase select (for vector engine) see table below. 4-0 ainsp30[4:0] r/w ain select refer to table 11-2 . phase select 00 not specified 01 u 10 v 11 w
page 11-39 TMPM372FWUG 2013/4/15 adbpset4:pmd trigger program register 4 31 30 29 28 27 26 25 24 bit symbol ensp43 uvwis43 ainsp43 after reset00000000 23 22 21 20 19 18 17 16 bit symbol ensp42 uvwis42 ainsp42 after reset00000000 15 14 13 12 11 10 9 8 bit symbol ensp41 uvwis41 ainsp41 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ensp40 uvwis40 ainsp40 after reset00000000 bit bit symbol type function 31 ensp43 r/w adbreg3 enable 0:disable 1:enable 30-29 uvwis43[1:0] r/w phase select (for vector engine) see table below. 28-24 ainsp43[4:0] r/w ain select refer to table 11-2 . 23 ensp42 r/w adbreg2 enable 0:disable 1:enable 22-21 uvwis42[1:0] r/w phase select (for vector engine) see table below. 20-16 ainsp42[4:0] r/w ain select refer to table 11-2 . 15 ensp41 r/w adbreg1 enable 0:disable 1:enable 14-13 uvwis41[1:0] r/w phase select (for vector engine) see table below. 12-8 ainsp41[4:0] r/w ain select refer to table 11-2 . 7 ensp40 r/w adbreg0 enable 0:disable 1:enable 6-5 uvwis40[1:0] r/w phase select (for vector engine) see table below. 4-0 ainsp40[4:0] r/w ain select refer to table 11-2 . phase select 00 not specified 01 u 10 v 11 w
page 11-40 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbpset5:pmd trigger program register 5 31 30 29 28 27 26 25 24 bit symbol ensp53 uvwis53 ainsp53 after reset00000000 23 22 21 20 19 18 17 16 bit symbol ensp52 uvwis52 ainsp52 after reset00000000 15 14 13 12 11 10 9 8 bit symbol ensp51 uvwis51 ainsp51 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ensp50 uvwis50 ainsp50 after reset00000000 bit bit symbol type function 31 ensp53 r/w adbreg3 enable 0:disable 1:enable 30-29 uvwis53[1:0] r/w phase select (for vector engine) see table below. 28-24 ainsp53[4:0] r/w ain select refer to table 11-2 . 23 ensp52 r/w adbreg2 enable 0:disable 1:enable 22-21 uvwis52[1:0] r/w phase select (for vector engine) see table below. 20-16 ainsp52[4:0] r/w ain select refer to table 11-2 . 15 ensp51 r/w adbreg1 enable 0:disable 1:enable 14-13 uvwis51[1:0] r/w phase select (for vector engine) see table below. 12-8 ainsp51[4:0] r/w ain select refer to table 11-2 . 7 ensp50 r/w adbreg0 enable 0:disable 1:enable 6-5 uvwis50[1:0] r/w phase select (for vector engine) see table below. 4-0 ainsp50[4:0] r/w ain select refer to table 11-2 . phase select 00 not specified 01 u 10 v 11 w
page 11-41 TMPM372FWUG 2013/4/15 11.4.22adbtset03 / adbtset47 / adbtset8 11 (timer trigger program registers) ad conversion can be started by inttb51 generated from timer5(tmrb5) as a trig ger. there are twelve 8- bit registers for programming timer triggers. setting the to "1" enables the adbtsetm register. the are used to select the ain pin to be used. th e numbers of the timer trigger program registers correspond to those of th e ad conversion result registers. when finished this ad conversion, interrupt : intadbtmr is generated. (m=0 to 11) table 11-3 select the ain pin to adc unit b 0_0000 :reserved 0_0001 :reserved 0_0010 :ainb2 0_0011 :ainb3 0_0100 :ainb4 0_0101 :ainb5 0_0110 :ainb6 0_0111 :ainb7 0_1000 :ainb8 0_1001 :ainb9 0_1010 :aina10 0_1011 :ainb11 0_1100 :ainb12 0_1101 to 1_1111 :reserved
page 11-42 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbtset03: timer trigger program registers 03 31 30 29 28 27 26 25 24 bit symbol enst3 - - ainst3 after reset00000000 23 22 21 20 19 18 17 16 bit symbol enst2 - - ainst2 after reset00000000 15 14 13 12 11 10 9 8 bit symbol enst1 - - ainst1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol enst0 - - ainst0 after reset00000000 bit bit symbol type function 31 enst3 r/w adbreg3 enable 0:disable 1:enable 30-29 - r read as "0". 28-24 ainst3[4:0] r/w ain select refer to table 11-3 . 23 enst2 r/w adbreg2 enable 0:disable 1:enable 22-21 - r read as "0". 20-16 ainst2[4:0] r/w ain select refer to table 11-3 . 15 enst1 r/w adbreg1 enable 0:disable 1:enable 14-13 - r read as "0". 12-8 ainst1[4:0] r/w ain select refer to table 11-3 . 7 enst0 r/w adbreg0 enable 0:disable 1:enable 6-5 - r read as "0". 4-0 ainst0[4:0] r/w ain select refer to table 11-3 .
page 11-43 TMPM372FWUG 2013/4/15 adbtset47: timer trigger program registers 47 31 30 29 28 27 26 25 24 bit symbol enst7 - - ainst7 after reset00000000 23 22 21 20 19 18 17 16 bit symbol enst6 - - ainst6 after reset00000000 15 14 13 12 11 10 9 8 bit symbol enst5 - - ainst5 after reset00000000 7 6 5 4 3 2 1 0 bit symbol enst4 - - ainst4 after reset00000000 bit bit symbol type function 31 enst7 r/w adbreg7 enable 0:disable 1:enable 30-29 - r read as "0". 28-24 ainst7[4:0] r/w ain select refer to table 11-3 . 23 enst6 r/w adbreg6 enable 0:disable 1:enable 22-21 - r read as "0". 20-16 ainst6[4:0] r/w ain select refer to table 11-3 . 15 enst5 r/w adbreg5 enable 0:disable 1:enable 14-13 - r read as "0". 12-8 ainst5[4:0] r/w ain select refer to table 11-3 . 7 enst4 r/w adbreg4 enable 0:disable 1:enable 6-5 - r read as "0". 4-0 ainst4[4:0] r/w ain select refer to table 11-3 .
page 11-44 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbtset811: timer trigger program registers 811 31 30 29 28 27 26 25 24 bit symbol enst11 - - ainst11 after reset00000000 23 22 21 20 19 18 17 16 bit symbol enst10 - - ainst10 after reset00000000 15 14 13 12 11 10 9 8 bit symbol enst9 - - ainst9 after reset00000000 7 6 5 4 3 2 1 0 bit symbol enst8 - - ainst8 after reset00000000 bit bit symbol type function 31 enst11 r/w adbreg11 enable 0:disable 1:enable 30-29 - r read as "0". 28-24 ainst11[4:0] r/w ain select refer to table 11-3 . 23 enst10 r/w adbreg10 enable 0:disable 1:enable 22-21 - r read as "0". 20-16 ainst10[4:0] r/w ain select refer to table 11-3 . 15 enst9 r/w adbreg9 enable 0:disable 1:enable 14-13 - r read as "0". 12-8 ainst9[4:0] r/w ain select refer to table 11-3 . 7 enst8 r/w adbreg8 enable 0:disable 1:enable 6-5 - r read as "0". 4-0 ainst8[4:0] r/w ain select refer to table 11-3 .
page 11-45 TMPM372FWUG 2013/4/15 11.4.23adbsset03 / adbsset47 / adbsset811( software trigger program registers ) ad conversion can be star ted by software. there are twelve 8-bit registers for programming software trig- gers. setting the to "1" enables the adxssetm register. the are used to select the ain pin to be used. the numbers of the software trig ger program registers correspond to those of the con- version result registers. when finished this ad conversion, interrupt :intadbsft is generated. (m=0 to 11) table 11-4 select the ain pin to adc unit b 0_0000 :reserved 0_0001 :reserved 0_0010 :ainb2 0_0011 :ainb3 0_0100 :ainb4 0_0101 :ainb5 0_0110 :ainb6 0_0111 :ainb7 0_1000 :ainb8 0_1001 :ainb9 0_1010 :aina10 0_1011 :ainb11 0_1100 :ainb12 0_1101 to 1_1111 :reserved
page 11-46 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbsset03: software trigger program registers 03 31 30 29 28 27 26 25 24 bit symbol enss3 - - ainss3 after reset00000000 23 22 21 20 19 18 17 16 bit symbol enss2 - - ainss2 after reset00000000 15 14 13 12 11 10 9 8 bit symbol enss1 - - ainss1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol enss0 - - ainss0 after reset00000000 bit bit symbol type function 31 enss3 r/w adbreg3 enable 0:disable 1:enable 30-29 - r read as "0". 28-24 ainss3[4:0] r/w ain select refer to table 11-4 . 23 enss2 r/w adbreg2 enable 0:disable 1:enable 22-21 - r read as "0". 20-16 ainss2[4:0] r/w ain select refer to table 11-4 . 15 enss1 r/w adbreg1 enable 0:disable 1:enable 14-13 - r read as "0". 12-8 ainss1[4:0] r/w ain select refer to table 11-4 . 7 enss0 r/w adbreg0 enable 0:disable 1:enable 6-5 - r read as "0". 4-0 ainss0[4:0] r/w ain select refer to table 11-4 .
page 11-47 TMPM372FWUG 2013/4/15 adbsset47: software trigger program registers 47 31 30 29 28 27 26 25 24 bit symbol enss7 - - ainss7 after reset00000000 23 22 21 20 19 18 17 16 bit symbol enss6 - - ainss6 after reset00000000 15 14 13 12 11 10 9 8 bit symbol enss5 - - ainss5 after reset00000000 7 6 5 4 3 2 1 0 bit symbol enss4 - - ainss4 after reset00000000 bit bit symbol type function 31 enss7 r/w adbreg7 enable 0:disable 1:enable 30-29 - r read as "0". 28-24 ainss7[4:0] r/w ain select refer to table 11-4 . 23 enss6 r/w adbreg6 enable 0:disable 1:enable 22-21 - r read as "0". 20-16 ainss6[4:0] r/w ain select refer to table 11-4 . 15 enss5 r/w adbreg5 enable 0:disable 1:enable 14-13 - r read as "0". 12-8 ainss5[4:0] r/w ain select refer to table 11-4 . 7 enss4 r/w adbreg4 enable 0:disable 1:enable 6-5 - r read as "0". 4-0 ainss4[4:0] r/w ain select refer to table 11-4 .
page 11-48 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbsset811: software trigger program registers 811 31 30 29 28 27 26 25 24 bit symbol enss11 - - ainss11 after reset00000000 23 22 21 20 19 18 17 16 bit symbol enss10 - - ainss10 after reset00000000 15 14 13 12 11 10 9 8 bit symbol enss9 - - ainss9 after reset00000000 7 6 5 4 3 2 1 0 bit symbol enss8 - - ainss8 after reset00000000 bit bit symbol type function 31 enss11 r/w adbreg11 enable 0:disable 1:enable 30-29 - r read as "0". 28-24 ainss11[4:0] r/w ain select refer to table 11-4 . 23 enss10 r/w adbreg10 enable 0:disable 1:enable 22-21 - r read as "0". 20-16 ainss10[4:0] r/w ain select refer to table 11-4 . 15 enss9 r/w adbreg9 enable 0:disable 1:enable 14-13 - r read as "0". 12-8 ainss9[4:0] r/w ain select refer to table 11-4 . 7 enss8 r/w adbreg8 enable 0:disable 1:enable 6-5 - r read as "0". 4-0 ainss8[4:0] r/w ain select refer to table 11-4 .
page 11-49 TMPM372FWUG 2013/4/15 11.4.24adbaset03 / adbas et47 / adbaset811( constant conversion program reg- isters ) the adcs allow conversion triggers to be constantly en abled. there are twelve 8- bit registers for program- ming constant triggers. setting the to "1" enables the adbasetm regi ster. the are used to select the ain pin to be used. the numbers of the constant trigger program registers correspond to those of the conversion result registers. (m=0 to 11) table 11-5 select the ain pin to adc unit b 0_0000 :reserved 0_0001 :reserved 0_0010 :ainb2 0_0011 :ainb3 0_0100 :ainb4 0_0101 :ainb5 0_0110 :ainb6r 0_0111 :ainb7 0_1000 :ainb8 0_1001 :ainb9 0_1010 :aina10 0_1011 :ainb11 0_1100 :ainb12 0_1101 to 1_1111 :reserved
page 11-50 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbaset03: constant conver sion program registers03 31 30 29 28 27 26 25 24 bit symbol ensa3 - - ainsa3 after reset00000000 23 22 21 20 19 18 17 16 bit symbol ensa2 - - ainsa2 after reset00000000 15 14 13 12 11 10 9 8 bit symbol ensa1 - - ainsa1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ensa0 - - ainsa0 after reset00000000 bit bit symbol type function 31 ensa3 r/w adbreg3 enable 0:disable 1:enable 30-29 - r read as "0". 28-24 ainsa3[4:0] r/w ain select refer to table 11-5 . 23 ensa2 r/w adbreg2 enable 0:disable 1:enable 22-21 - r read as "0". 20-16 ainsa2[4:0] r/w ain select refer to table 11-5 . 15 ensa1 r/w adbreg1 enable 0:disable 1:enable 14-13 - r read as "0". 12-8 ainsa1[4:0] r/w ain select refer to table 11-5 . 7 ensa0 r/w adbreg0 enable 0:disable 1:enable 6-5 - r read as "0". 4-0 ainsa0[4:0] r/w ain select refer to table 11-5 .
page 11-51 TMPM372FWUG 2013/4/15 adbaset47: constant conversion program registers 47 31 30 29 28 27 26 25 24 bit symbol ensa7 - - ainsa7 after reset00000000 23 22 21 20 19 18 17 16 bit symbol ensa6 - - ainsa6 after reset00000000 15 14 13 12 11 10 9 8 bit symbol ensa5 - - ainsa5 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ensa4 - - ainsa4 after reset00000000 bit bit symbol type function 31 ensa7 r/w adbreg7 enable 0:disable 1:enable 30-29 - r read as "0". 28-24 ainsa7[4:0] r/w ain select refer to table 11-5 . 23 ensa6 r/w adbreg6 enable 0:disable 1:enable 22-21 - r read as "0". 20-16 ainsa6[4:0] r/w ain select refer to table 11-5 . 15 ensa5 r/w adbreg5 enable 0:disable 1:enable 14-13 - r read as "0". 12-8 ainsa5[4:0] r/w ain select refer to table 11-5 . 7 ensa4 r/w adbreg4 enable 0:disable 1:enable 6-5 - r read as "0". 4-0 ainsa4[4:0] r/w ain select refer to table 11-5 .
page 11-52 11. 12-bit analog-to-digital converters 11.4 register descriptions TMPM372FWUG 2013/4/15 adbaset811: cnstant conversion program registers 811 31 30 29 28 27 26 25 24 bit symbol ensa11 - - ainsa11 after reset00000000 23 22 21 20 19 18 17 16 bit symbol ensa10 - - ainsa10 after reset00000000 15 14 13 12 11 10 9 8 bit symbol ensa9 - - ainsa9 after reset00000000 7 6 5 4 3 2 1 0 bit symbol ensa8 - - ainsa8 after reset00000000 bit bit symbol type function 31 ensa11 r/w adbreg11 enable 0:disable 1:enable 30-29 - r read as "0". 28-24 ainsa11[4:0] r/w ain select refer to table 11-5 . 23 ensa10 r/w adbreg10 enable 0:disable 1:enable 22-21 - r read as "0". 20-16 ainsa10[4:0] r/w ain select refer to table 11-5 . 15 ensa9 r/w adbreg9 enable 0:disable 1:enable 14-13 - r read as "0". 12-8 ainsa9[4:0] r/w ain select refer to table 11-5 . 7 ensa8 r/w adbreg8 enable 0:disable 1:enable 6-5 - r read as "0". 4-0 ainsa8[4:0] r/w ain select refer to table 11-5 .
page 11-53 TMPM372FWUG 2013/4/15 11.5 operation descriptions 11.5.1 analog reference voltages for the high-level and low-level analog reference vo ltages, the vrefhb and vreflb pins are used in adc b. there are no registers for controlling current between vrefhb and vreflb. inputs to these pins are fixed. note 1: during ad conversion, do not change the output data of port h/i/j/k, to avoid the influence on the conver- sion result. note 2: ad conversion results might be unstable by the following conditions. input operation is executed. output operation is executed. output current of port varies. take a countermeasure such as averaging the multip le conversion results, to get precise value. 11.5.2 starting ad conversion ad conversion is started by software or one of the following three trigger signals. these start triggers are given priorities as shown below. if the pmd trigger occurs while an ad conversion is in progress, the pmd trigger is handled stop the ongo- ing program and start ad conversion correspond to pmd trigger number. if a higher-priority trigger occurs wh ile an ad conversion is in progress, the higher-priority trigger is han- dled after the ongoing program is completed. it has some delay from generation of trigger to start of ad conversion. the delay depends on the trigger. the following timing chart and table show the delay. figure 11-3 timing chart of ad conversion pmd trigger 0 > ???? > pmd trigger 5 > timer trigger > software trig- ger > constant trigger trigger busy flag 1st conversion 2nd conversion result of 1st conversion result of 2nd conversion delay time from trigger ad conversion time delay time to the next conversion ad conversion time ad conversion ysftvju sfhjtufs "%#3&(
ad conversion ysftvju sfhjtufs "%#3&(

page 11-54 11. 12-bit analog-to-digital converters 11.5 operation descriptions TMPM372FWUG 2013/4/15 note 1: delay time from trigger to start of ad conversion. note 2: delay time to the 2nd or after conversion in plural conversions with one trigger. 11.5.3 ad conversion monitoring function the adcs have the ad conversion monitoring function. when this function is enabled, an interrupt is gen- erated when a conversion result matc hes the specified comparison value. to enable the monitoring function, set adbcmp cr0 or adbcmpcr1 to "1". in the monitoring function, if the value of ad conversion result register to which the monitoring function is assigned corresponds to the comparison condition specified by adbcmcr, the interrupt (intad- bcpb for adbcmpcr1) is generated. the comparison is executed at the timing of storing the conversion result into the register. note 1: the ad conversion result store flag ( to ) is not cleared by the comparison function. note 2: the comparison function differs from reading the c onversion result by software. therefore, if the next con- version is completed without reading the previous re sult, the overrun flag ( to ) is set. table 11-6 ad conversion time (sclk = 40mhz) fsys = 80mhz fsys = 40mhz trigger min max min max delay time from trig- ger [ s] (note 1) pmd 0.125 0.163 0.225 0.3 tmrb 0.125 0.263 0.225 0.5 software, constant 0.138 0.275 0.25 0.525 ad conversion time[ s] ? 1.85 1.85 delay time to the next conversion[ s] (note2) pmd 0.1 0.125 0.175 0.225 tmrb, software, con- stant 0.1 0.238 0.175 0.425
page 11-55 TMPM372FWUG 2013/4/15 11.6 timing chart of ad conversion the following shows a timing chart of software trigger conversion, constant conversion and acceptance of trigger. 11.6.1 software trigger conversion in the software trigger conversion, the interrupt is generated after completion of conversion programmed by adbsset03, adbsset47 and adbsset811.(figure 11-4) if the adbmod1 is cleared to "0" during ad conversion, the ongoing conversion stops without storing to the result register.(figure 11-5) figure 11-4 software trigger ad conversion condition software trigger setting : ainab2, ainb9, ainb10, ainb11, ainb12 ainb2 conversion ainb9 conversion ainb10 conversion ainb11 conversion ainb12 conversion ad conversion busy flag varies according to conversion  intadsft is generated by the completition of selected ad conversion at the timing of clearing of . software trigger conversion (="1") ad conversion busy flag software conversion busy flag software trigger ad conversion interrupt 9? intadasft 9?
page 11-56 11. 12-bit analog-to-digital converters 11.6 timing chart of ad conversion TMPM372FWUG 2013/4/15 figure 11-5 writing "0" to during the softwa re trigger ad conversion software trigger conversion (="1") ainb10 conversion result register for ainb10 ainb11 conversion ad conversion busy flag ad conversion result register adsfn is cleared to ?0? immediately after clearing to ?0? . ad conversion enable/disable the result of ainb10 is stored to the result register. the conversion of ainb12 doesn? t start. software conversion busy flag clearing of is delayed. the result of ainb11 is not stored to the result register. condition software trigger setting : ainb10, ainb11, ainb12
page 11-57 TMPM372FWUG 2013/4/15 11.6.2 constant conversion in the constant conversion, if the next conversion co mpletes without reading the previous result from the conversion result register, the overrun flag is set to "1". in this case, the previous conversion result in the con- version result register is overwritten by the next result. the overrun flag is cleared by reading of the conversion result.(figure 11-6) figure 11-6 constant conversion ainb2 conversion ainb2 conversion ainb2 conversion ainb2 conversion ainb2 conversion ad conversion reading of the result register(16bit) constant conversion control (="1") 1st result of ainb2 2nd result of ainb2 3rd result of ainb2 4th result of ainb2 ad conversion result store flag over run flag over run flag is set caused by no reading of 1st result. reading of 2nd result makes over run flag cleared. 2nd result is read. ad conversion result register ad conversion busy flag 3rd result is read. condition constant conversion setting : ainb2
page 11-58 11. 12-bit analog-to-digital converters 11.6 timing chart of ad conversion TMPM372FWUG 2013/4/15 11.6.3 ad conversion by trigger if the pmd trigger is occurred during the software trigger conversion, the ongoing conversion stops immedi- ately.(figure 11-7) if the timer trigger is occurred during the software tr igger conversion, th e ongoing conver- sion stops after the completion of ongoing conversion. (figure 11-8) after the completion of conversion by trigger, the software trigger conversion starts from the beginning programmed by adbsset03, adbsset47 and adbsset811.(figure 11-9) figure 11-7 ad conv ersion by pmd trigger figure 11-8 ad conversi on by timer trigger (1) ainb10 conversion by software trigger max 250ns ad conversion ainb11 conversion by software trigger pmd trigger ainb2 conversion by pmd trigger software trigger conversion interrupt 9? intadasft 9? the interrupt is generated after completion of the software ad conversion. condition software trigger setting : ainb10, ainb11, ainb12 pmd trigger setting : ainb2 pmd trigger conversion interrupt (intadpdx) 9? when the interrupt is enabled by adbpints) ainb10 to ainb12 conversion by software trigger the conversion of ainb11 is stopped by pmd trigger and starts the conversion triggered by pmd. ad conversion by software trigger ad conversion by pmd trigger ad conversion by software trigger ad conversion timer trigger ad conversion result register result register for ainb10 the interrupt is generated by the completion of the timer trigger ad conversion. condition software trigger setting : ainb10 timer trigger setting : ainb11 the conversion by timer trigger will start after completion of the current conversion. ainb10 conversion by software trigger ainb11 conversion by timer trigger ainb10 conversion by software trigger ad conversion by software trigger ad conversion by software trigger ad conversion by timer trigger software trigger ad conversion interrupt 9? intadasft 9? timer trigger ad conversion interrupt 9? intadatmr 9? result register for ainb11 result register for ainb10 the interrupt is generated by the completion of the software ad conversion. no interrupt is generated at the end of conversion interrupted by the timer trigger.
page 11-59 TMPM372FWUG 2013/4/15 figure 11-9 ad conversi on by timer trigger (2) ad conversion timer trigger result register for ainb10 condition software trigger setting : ainb10, ainb11, ainb12 timer trigger setting : ainb2 the software conversion will start from the beginning after the completion of conversion by timer trigger. the conversion by timer trigger will start after completion of the current conversion. ainb10 conversion by software trigger ainb11 conversion by software trigger ainb2 conversion by timer trigger ainb10 conversion by software trigger ainb10 to ainb12 conversion by software trigger ad conversion by software trigger ad conversion by software trigger ad conversion by timer trigger result register for ainb11 result register for ainb2 result register for ainb10 to ainb12 the interrupt is generated by the completion of the timer trigger ad conversion. the interrupt is generated by the completion of the software ad conversion. no interrupt is generated at the end of conversion interrupted by the timer trigger. ad conversion result register software trigger ad conversion interrupt 9? intadasft 9? timer trigger ad conversion interrupt 9? intadatmr 9?
page 11-60 11. 12-bit analog-to-digital converters 11.6 timing chart of ad conversion TMPM372FWUG 2013/4/15
page 12-1 TMPM372FWUG 2013/4/15 12. motor control circuit (pmd: programmable motor driver) the TMPM372FWUG contains 1 channel programmable motor driver (pmd). the pmd of this product has newly added features of conduction output control and dc overvoltage detection to realize sensorless motor control and supports interaction with the ad converter. figure 12-1 motor control-related block constitution cpu io bus i/f pmd interrupt ve adc interrupt analog input conduction output pwm/trigger setting adc sync trigger conversion result interrupt emg detection input overvoltage detection input motor current,moter voltage emg1 ovv1 uo1,vo1,wo1, xo1,yo1,zo1
page 12-2 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.1 pmd input/output signals TMPM372FWUG 2013/4/15 12.1 pmd input/output signals the table below shows the signals that are input to and output from pmd. table 12-1 input/output signals channe pin name pmd signal name description pmd1 pg7/ ovv1 ovv 1 ovv state signal pg6/ emg1 emg 1 emg state signal pg0/uo1 uo 1 u-phase output pg1/xo1 xo 1 x-phase output pg2/vo1 vo 1 v-phase output pg3/yo1 yo 1 y-phase output pg4/wo1 wo 1 w-phase output pg5/zo1 zo 1 z-phase output
page 12-3 TMPM372FWUG 2013/4/15 12.2 pmd circuit figure 12-2 block di agram of pmd circuit the pmd circuit consists of two blocks of a wave ge neration circuit and a sync trigger generation circuit. the wave generation circuit includes a pulse width modulation circuit, a conduction control circuit, a protection control circuit, a dead time control circuit. ? the pulse width modulation circuit generates independent 3-phase pwm waveforms with the same pwm frequency. ? the conduction control circuit determ ines the output pattern for each of the upper and lower sides of the u, v and w phases. ? the protection control circuit controls emergency output stop by emg input and ovv input. ? the dead time control circuit prevents a short circu it which may occur when the upper side and lower side are switched. ? the sync trigger generation circuit generate s sync trigger signals to the ad converter. the table below shows the registers related to the pmd. porten wave generation circuit pulse width modulation conduction contorol protection contorol dead time contorol u x v y w z u x v y w z sync trigger generation ve pmdtrg0 pmdtrg1 pmdtrg2 pmdtrg3 pmdtrg4 pmdtrg5 ve upequs dnequs intpwm pwmu pwmv pwmw ptenc sync trigger generation circuitt ve pmd1emgcr pmd1ovvcr intovv1 pmd1mdcr pmd1mdout pmd1dtr pmd1mdpot pmd1mdpr pmd1emgrel pmd1cmpu pmd1cmpv pmd1cmpw pmd1trgcmp0 pmd1trgcmp1 pmd1trgcmp2 pmd1trgcmp3 pmd1trgcr uo1 xo1 vo1 yo1 wo1 zo1 emg1 intemg1 ovv1 pmd1mdcnt
page 12-4 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3 pmd registers note: do not access to "reserved" address. base address = 0x4005_0480 register name (x=0,1) address(base+) pmd enable register pmd1mden 0x0000 port output mode register pmd1portmd 0x0004 pmd control register pmd1mdcr 0x0008 pwm counter status register pmd1cntsta 0x000c pwm counter register pmd1mdcnt 0x0010 pwm period register pmd1mdprd 0x0014 pmd compare u register pmd1cmpu 0x0018 pmd compare v register pmd1cmpv 0x001c pmd compare w register pmd1cmpw 0x0020 mode select register pmd1modesel 0x0024 pmd output control register pmd1mdout 0x0028 pmd output setting register pmd1mdpot 0x002c emg release register pmd1emgrel 0x0030 emg control register pmd1emgcr 0x0034 emg status register pmd1emgsta 0x0038 ovv control register pmd1ovvcr 0x003c ovv status register pmd1ovvsta 0x0040 dead time register pmd1dtr 0x0044 trigger compare 0 register pmd1trgcmp0 0x0048 trigger compare 1 register pmd1trgcmp1 0x004c trigger compare 2 register pmd1trgcmp2 0x0050 trigger compare 3 register pmd1trgcmp3 0x0054 trigger control register pmd1trgcr 0x0058 trigger output mode setting register pmd1trgmd 0x005c trigger output select register pmd1trgsel 0x0060 reserved ? 0x007c
page 12-5 TMPM372FWUG 2013/4/15 12.3.1 pmd1mden(pm d enable register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------pwmen after reset00000000 bit bit symbol type function 31-1 - r read as 0. 0 pwmen r/w enables or disables waveform synthesis. 0: disable 1: enable output ports that are used for the pmd become high-z when the pmd is disabled. before enabling the pmd, setting ="1"(enable) other relevant settings, such as output port polarity.
page 12-6 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.2 pmd1portmd(port output mode register) note 1: when =0, output ports are set to high-z regardless of the output port setting. note 2: when an emg input occurs, external port outputs are controlled depending on the pmd1emgcr setting. 12.3.3 pmd1modesel (m ode select register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------ portmd after reset00000000 bit bit symbol type function 31-2 - r read as 0. 1-0 portmd[1:0] r/w port control setting 00: upper phases = high-z / lower phases = high-z 01: upper phases = high-z / ower phases = pmd output 10: upper phases = pmd output / lower phases = high-z 11: upper phases = pmd output / lower phases = pmd output the setting controls external port ou tputs of the upper phases (u, v and w phases) and the lower phases (x, y and z phases). when a tool brea k occurs while "high-z" is selected, the upper and lower phases of external output ports are set to high-z. in other cases, external port outputs depend on pmd outputs. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------mdsel after reset00000000
page 12-7 TMPM372FWUG 2013/4/15 bit bit symbol type function 31-1 - r read as 0. 0 mdsel r/w mode select register 0: bus mode 1: ve mode this bit selects whether to load the second buffer of each double-buffered register with the register value set via the bus (bus mode) or the value supplied fr om the vector engine (ve mode). the pwm compare registers (pmd1cmpu,pmd1cmpv, pmd1cmpw), trigger compare registers (pmd1trgcmp0, pmd1trgcmp1) andpmd1 mdout register are double-buffered, and the second buffers are loaded in synchronization with the pmd?s internal update timing.
page 12-8 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.4 pulse widt h modulation circuit figure 12-3 pulse width modulation circuit the pulse width modulation circuit has a 16-bit pmd up-/down-counter and generates pwm carrier wave- forms with a resolution of 12.5 nsec at 80 mhz. the pw m carrier waveform mode can be selected from mode 0 (edge-aligned pwm, sawtooth wave modulation) and mode 1 (center-aligned pwm, triangular wave modu- lation). the pwm period extension mode (pmd1mdcr = 1) is also available. when this mode is selected, the pwm counter generates pwm carri er waveforms with a resolution of 50 nsec. 4 up/down mdcnt cmprld fsys pmd counter status register pmd control register pwm sync clock upequs,dnequs pwm counter register pwm control pwm counter pwm interrupt request intpwm clock control pwm period register pwm compare register selector 0x0001 pwmw pwmv pwmu buffer v buffer u buffer w a=b selector /latch > pmd1cntsta pmd1mdcr pmd1mdcnt pmd1mdprd pmd1cmpu pmd1cmpv pmd1cmpw a b a b a b
page 12-9 TMPM372FWUG 2013/4/15 1. setting the pwm period the pwm period is determined by the pmd1mdprd register. this register is double-buffered. comparator input is updated at ev ery pwm period. it is also possible to update comparator input at every half pwm period. 2. compare function the pulse width modulation circuit compares the pwm compare registers of the 3 phases (pmd1cmpu / v / w) and the carrier wave generated by the pwm counter (pmd1mdcnt) to determine which is larger to generate pwm waveforms with the desired duty. the pwm compare register of each phase has a double-buffered compare register. the pwm com- pare register value is loaded at every pwm peri od (when the internal counter value matches the value). it is also possible to update the co mpare register at every 0.5 pwm period. figure 12-4 pwm waveforms 5cyvqqvjycxgpwm : register 8cnwg= pwm frequency [hz] 1ueknncvkqphtgswgpe[[ h pmd1mdprd trianguler wave pwm : register value = pwm frequency [hz] x 2 oscillation frequency [hz] pmd1mdprd pwmu waveform on off pwmu waveform on off 6kog =5cyvqqvjycxg? 6kog =6tkcpiwnctycxg? 9jgpuykvejkpihtqoeqwpvkpi fqypvqeqwpvkpiwr /&%06=? kpvyqe[engu 9jgpuykvejkpihtqoeqwpvkpi fqypvqeqwpvkpiwr /&%06=? rgcmxcnwg
/&24&=? kpvyqe[eng pmd1mdprd pmd1cmpu pmd1mdprd pmd1cmpu counts up to pmd1mdprd and is cleared to "1" in the next cycle.
page 12-10 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 3. waveform mode three-phase pwm waveforms can be generated in the following two modes: 1. 3-phase independent mode: each of the pwm compare registers for the three phases is set independently to generate independent pwm waveforms for each phase. this mode is used to generate drive waveforms such as sinusoidal waves. 2. 3-phase common mode: only the u-phase pwm compare register is set to generate identical pwm waveforms for all the three phases. this mode is used for rect angular wave drive of brushless dc motors. 4. interrupt processing the pulse width modulation circuit generates pwm interrupt requests in synchronization with pwm waveforms. the pwm interrupt period can be set to half a pwm period, one pwm period, two pwm periods or four pwm periods.
page 12-11 TMPM372FWUG 2013/4/15 12.3.4.1 pmd1mdcr (pmd control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - pwmck syntmd dtymd pint intprd pwmmd after reset00000000 bit bit symbol type function 31-7 - r read as 0. 6 pwmck r/w pwm period extension mode 0: normal period 1: 4x period when = "0", the pwm counter operates wit h a resolution of 12.5 ns at fsys=80 mhz. ? sawtooth wave: 12.5 ns, triangular wave: 25 ns when ="1", the pwm counter operates with a resolution of 50 ns at fsys=80 mhz. ? sawtooth wave: 50 ns, triangular wave: 100 ns 5 syntmd r/w port output mode this bit specifies the port output settin g of the u, v and w phases. (see table 12-2.) 4 dtymd r/w duty mode 0: 3-phase common mode 1: 3-phase independent mode this bit selects whether to make duty setting independently for each phase or to use the pmd1cmpu reg- ister for all three phases. 3 pint r/w pwm interrupt timing 0: interrupt request when pwm counter pmd1mdcnt = 0x0001 1: interrupt request when pwm counte r pmd1mdcnt = this bit selects whether to generate an interrupt request when the pwm counter equals its minimum or max- imum value. when the edge-aligned pwm mode is selected, an interrupt request is generated when the pwm counter equals the value. when the pwm interrupt period is set to every 0.5 pwm period, an interrupt request is generated when the pwm counter equals "1" or . 2-1 intprd[1:0] r/w pwm interrupt period 00: interrupt request at every 0.5 pwm period (= "1" only) 01: interrupt request at every pwm period 10: interrupt request at every 2 pwm periods 11: interrupt request at every 4 pwm periods this field selects the pwm interrupt period from 0.5 pwm period, one pwm period, two pwm periods and four pwm periods. ? note) when = "00", the contents of the compare registers (pmd1cmpu/v/w) and period register (pmd1mdprd) are updated into their respective buffers when the internal counter equals 1 or the pmd1mdprd value. 0 pwmmd r/w pwm carrier waveform 0: pwm mode 0 (edge-aligned pwm, sawtooth wave) 1: pwm mode 1(center-aligned pwm, triangular wave) this bit selects the pwm mode. pwm mode 0 is edge-aligned pwm and pwm mode 1 is center-aligned pwm.
page 12-12 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.4.2 pmd1cntsta (pwm counter status register) 12.3.4.3 pmd1mdcnt(pwm counter register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------updwn after reset00000000 bit bit symbol type function 31-1 - r read as 0. 0 updwn r pwm counter flag 0: up-counting 1: down-counting this bit indicates whether the pwm c ounter is up-counting or down-counting. when the edge-aligned pwm mode is selected, this bit is always read as 0. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol mdcnt after reset00000000 7 6 5 4 3 2 1 0 bit symbol mdcnt after reset00000000 bit bit symbol type function 31-16 - r read as 0. 15-0 mdcnt[15:0] r pwm counter pmd counter value (resolution: 12.5 ns at fsys = 80 mhz) ? sawtooth wave: 12.5 ns, triangular wave: 25 ns ? when pmd1mdcr = 1, the counter resolution becomes 50 ns. a16-bit counter for reading the pwm period count value. it is read-only. ? when the pmd is disabled (=0), the value of pwm counter depends on the setting of (pwm carrier waveform). the value is as follows. in case of pmd1mdcr= 0 : 0x0001 in case of pmd1mdcr= 1 : the value of pmd1mdprd
page 12-13 TMPM372FWUG 2013/4/15 12.3.4.4 pmd1mdprd(pwm period register) note: do not write to this register in byte units. if the upper 8 bits [15:8] and the lower 8 bits [7:0] are written separately, operation cannot be guaranteed. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol mdprd after reset00000000 7 6 5 4 3 2 1 0 bit symbol mdprd after reset00000000 bit bit symbol type function 31-16 - r read as 0. 15-0 mdprd[15:0] r/w pwm period 0x010 a 16-bit register for specifying the pwm period. this register is double-buffered and can be changed even when the pwm counter is operating. the buffer is loaded at every pwm period. (that is, when the pwm counter matches the value. when 0.5 pwm period is selected, loading is performed when the pwm counter matches 1 or . the least significant bit must be set as 0.) if is set to a value less than 0x0010, it is automatically assume d to be 0x0010. (the reg- ister retains the actual value that is written.)
page 12-14 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.4.5 pmd1cmpu ( pwm compare registers of u phase ) note 1: to load the second buffer with the value in the compare register updated via the bus, select the bus mode (default) by set ting pmd1modesel to 0. note 2: do not write to these registers in byte units. if the upper 8 bits [15:8] and the lower 8 bits [7:0] are written separately, operation cannot be guaranteed. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol cmpu1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol cmpu1 after reset00000000 bit bit symbol type function 31-16 - r read as 0. 15-0 cmpu1[15:0] r/w pwm pulse width of u phase compare registers (resolution : 12.5 ns at fsys =80 mhz) ? sawtooth wave: 12.5 ns, triangular wave: 25 ns ? when mdcr="1", the counter resolution becomes 50 ns. are compare registers for determining the output pulse width of the u phases. theses registers are double-buffered. pulse width is determined by comparing the buffer and the pwm counter to evaluate which is larger. (to be loaded when the pwm counter value matches the value. when 0.5 pwm period is selected, loading is pe rformed when the pwm counter matches 1 or .) when this register is read, the value of the first buffer (data set via the bus) is returned.
page 12-15 TMPM372FWUG 2013/4/15 12.3.4.6 pmd1cmpv (pwm compare registers of v phase) note 1: to load the second buffer with the value in the compare register updated via the bus, select the bus mode (default) by setting pmd1modesel to 0. note 2: do not write to these registers in byte units. if the upper 8 bits [15:8] and the lower 8 bits [7:0] are written separately, operation cannot be guaranteed. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol cmpv1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol cmpv1 after reset00000000 bit bit symbol type function 31-16 - r read as 0. 15-0 cmpv1[15:0] r/w pwm pulse width of v phase compare registers (resolution : 12.5 ns at fsys =80 mhz) ? sawtooth wave: 12.5 ns, triangular wave: 25 ns ? when mdcr=1, the counter resolution becomes 50 ns. are compare registers for determining the output pulse width of the v phases. theses registers are double-buffered. pulse width is determined by comparing the buffer and the pwm counter to evaluate which is larger. (to be loaded when the pwm counter value matches the value. when 0.5 pwm period is selected, loading is pe rformed when the pwm counter matches 1 or .) when this register is read, the value of the first buffer (data set via the bus) is returned.
page 12-16 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.4.7 pmd1cmpw (pwm compare registers of w phase) note 1: to load the second buffer with the value in the compare register updated via the bus, select the bus mode (default) by setting pmd1modesel to 0. note 2: do not write to these registers in byte units. if the upper 8 bits [15:8] and the lower 8 bits [7:0] are written separately, operation cannot be guaranteed. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol cmpw1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol cmpw1 after reset00000000 bit bit symbol type function 31-16 - r read as 0. 15-0 cmpw1[15:0] r/w pwm pulse width of w phase compare registers (resolution : 12.5 ns at fsys =80 mhz) ? sawtooth wave: 12.5 ns, triangular wave: 25 ns ? when mdcr=1, the counter resolution becomes 50 ns. are compare registers for determinin g the output pulse width of the w phases. theses registers are double-buffered. pulse width is determined by comparing the buffer and the pwm counter to evaluate which is larger. (to be loaded when the pwm counter value matches the value. when 0.5 pwm period is selected, loading is pe rformed when the pwm counter matches 1 or .) when this register is read, the value of the first buffer (data set via the bus) is returned.
page 12-17 TMPM372FWUG 2013/4/15 12.3.5 conduction control circuit figure 12-5 conducti on control circuit the conduction control circuit performs output po rt control according to the settings made in the "pmd1mdout". the pmd1mdout register bits are divided into two parts: settings for the synchronizing signal for port output and settings for port output. the latter part is double-buffered and update timing can be set as synchronous or asynchronous to pwm. the output settings for six port lines are made indepe ndently for each of the upper and lower phases through the bits 10 to 8 of the pmd1mdpotregister and bits 3 and 2 of the pmd1mdpot register. in addition, bits 10 to 8 of the pmd1mdout register select pwm or hi gh/low output for each of the u, v and w phases. when pwm output is selected, pw m waveforms are output. when high/low output is selected, output is fixed to either a high or low le vel. table 12-2 shows a summ ary of port outputs according to port output settings in the pmd1mdout register and polarity settings in the pmd1mdcr register. decoder decoder decoder mux pwm u pwm v pwm w ff ff ff dtymd 0 1 xpwm outd pwmin pwmin x mdde c ff rel ff ff ff c c c c c c sync ve : outcr pmd1modesel pmd1mdout pmd1mdcr
page 12-18 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.5.1 pmd1mdpot (pmd output setting register) note: this field must be set while pmd1mden=0. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol----polhpoll psyncs after reset00000000 bit bit symbol type function 31-4 - r read as 0. 3 polh r/w upper phase port polarity (note) 0: active low 1: active high polh selects the output port polarity of the upper phases. 2 poll r/w lower phase port polarity (note) 0: active low 1: active high poll selects the output port polarity of the lower phases. 1-0 psyncs[1:0] r/w mdout transfer timing (note) 00: async to pwm 01: load when pwm counter = 1 10: load when pwm counter = pmd1mdprd 11: load when pwm counter = 1 or pmd1mdprd psyncs selects the timing when the u-, v- and w-phase output settings are reflected in port outputs (sync or async to the pwm counter peak, bottom or peak/bottom). when "00" (async to pwm) is selected, the changing of mdout register is applied to the u-, v- and w- phase output immediately. the is also available in the vector engine.
page 12-19 TMPM372FWUG 2013/4/15 12.3.5.2 pmd1mdout(pmd output control register) note 1: to load the second buffer of pwm1 mdout with a value updated via the bus, select the bus mode (default) by setti ng pmd1modesel to 0. note 2: do not write to this register in byte units. if the upper 8 bits [15:8] and the lower 8 bits [7:0] are written separately, operation cannot be guaranteed. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-----wpwmvpwmupwm after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - woc voc uoc after reset00000000 bit bit symbol type function 31-11 - r read as 0. 10 wpwm r/w u-, v-, and w-phase output control 0: high/low output 1: pwm output the mdout register controls the port outputs of the u, v and w phases (see table 12-2 below.) 9vpwm r/w 8upwm r/w 7-6 - r read as 0. 5-4 woc[1:0] r/w u-, v-, and w-phase output control the mdout register controls the port outputs of the u, v and w phases (see table 12-2below.) 3-2 voc[1:0] r/w 1-0 uoc[1:0] r/w
page 12-20 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 ? output settings for one-shunt mode one-shunt can be supported by the following settings. table 12-2 port outputs according to the , , , , and settings pmd1mdcr=0 pmd1mdcr=0 polarity: active high (pmd1mdpot="11") polarity: active low (pmd 1mdpot="00") pmd1mdout output control output select pmd1mdout output control output select (upper phase) (lower phase) (upper phase) (lower phase) 0: h/l output 1: pwm output 0: h/l output 1: pwm output upper phase output lower phase output upper phase output lower phase output upper phase output lower phase output upper phase output lower phase output 00ll pwm pwm 0 0 h h pwm pwm 01lhlp w m 01hlh pwm 10hlp w ml 10lh pwm h 11hhp w m pwm 11ll pwm pwm pmd1mdcr=1 pmd1mdcr=1 polarity: active high (pmd1mdpot="11") polarity: active low (pmd 1mdpot="00") pmd1mdout output control output select pmd1mdout output control output select (upper phase) (lower phase) (upper phase) (lower phase) 0: h/l output 1: pwm output 0: h/l output 1: pwm output upper phase output lower phase output upper phase output lower phase output upper phase output lower phase output upper phase output lower phase output 00ll pwm pwm 0 0 h h pwm pwm 01lhl pwm 01hlhp w m 10hlp w ml 10lh pwm h 11hhp w m pwm 11ll pwm pwm table 12-3 register settings for one-shunt normal pwm center on u-phase pwm center off v-phase pwm center off w-phase pwm center off cmpu duty_u -duty_u duty_u duty_u cmpv duty_v duty_v -duty_v duty_v cmpw duty_w duty_w duty_w -duty_w 11 00 11 11 11 11 00 11 11 11 11 00
page 12-21 TMPM372FWUG 2013/4/15 12.3.6 protection control circuit figure 12-6 protec tion control circuit the protection control circuit consists of an emg protection control circuit and an ovv protection control circuit. protection control u x v y w u? z x? v? y? w? z? pten_n lower phase output enable emg port input enable intemg emg interrupt emg emg input emg release register emg controi register ptenc ovv control register intovv ovv interrupt ovv ovv input pten_p upper phase output enable pmd1emgcr pmd1emgrel pmd1ovvcr
page 12-22 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.6.1 emg protection circuit the emg protection circuit consists of an emg protection control unit and a port output disable unit. this circuit is activated wh en the emg input becomes low. the emg protection circuit offers an emergency stop mechanism: when the emg input is asserted (h l), all six port outputs are immediately disabl ed (depending on the pmd1emgcr set- ting) and an emg interrupt (intemg) is generated. can be set to output a control signal that sets external output ports to high-z in case of an emergency. a tool break also disables all six pwm output lines depending on the pmd1portmd set- ting. when a tool break occurs, external output ports can be set to high-z through the setting of the pmd1emgsta register. emg protection is set through the emg control register (pmd1emgcr). a read value of 1 in emgsta indicates that the emg protection circuit is active. in this state, emg protection can be released by setting all the port output lines inactive (pmd1mdout<[10:8]><[5:0]>) and then setting em gcr to 1. to disable the emg protec- tion function, write "0x5a" and "0xa5" in this order to the emgrel register and then clear emgcr to 0. (these three instructions mu st be executed consecutively.) while the emg pro- tection input is low, any attempt to release the emg protection state is ignored. before setting pmd1mgcr to 1 to release emg protecti on, make sure that pm d1emgst is high. the emg protection circuit can be disabled only after the specified key codes ("0x5a", "0xa5") are written in the register to prevent it from being inadvertently disabled. note: initial procedure for emg function after reset, the emg function is enabled but emg pin is conf igured as a normal port. therefore, as the emg protection might be valid, release the emg protection by the following procedure at the initial sequence. 1: selects emg function by pxfr register. 2: reads pmd1emgsta to confirm it as "1". 3: sets pmd1mdout<[10:8]>, <[5:0]> to "0" to make all ports in-active ("l" output). 4: releases emg protection by se tting pmd1emgcr to "1". if the emg protection is to be disabled, continue the following procedure. 5: writes the key codes to pmd1emgrel (in order of "0x5a" and "0xa5") 6: sets pmd1emgcr to "0" to disable the emg protection.
page 12-23 TMPM372FWUG 2013/4/15 12.3.6.2 pmd1emgrel (emg release register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol emgrel after reset00000000 bit bit symbol type function 31-8 - r read as 0. 7-0 emgrel[7:0] w emg disable code the emg and ovv protection functions can be disabled by setting 0x5a and 0xa5 in this order to bits 7 to 0 of the register. when disabling these functions, and must be cleared to "0". ? this register is used for both the emg and ovv functions.
page 12-24 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.6.3 pmd1emgcr (emg control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol---- emgcnt after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - inhen emgmd - emgrs emgen after reset00111001 bit bit symbol type function 31-12 - r read as 0. 11-8 emgcnt[3:0] r/w emg input detection time the noise remove time value can be calculated by following formula. 16/fsys (resolution: 200[nsec] at 80 mhz) = 0 to 15 (when = 0, the noise filter is bypassed.) 7-6 - r read as 0. 5 inhen r/w tool break enable/disable 0: disable 1: enable this bit selects whether or not to stop the pmd when the pmd stop signal is input from the tool. in the ini- tial state, tool breaks are enabled. 4-3 emgmd[1:0] r/w emg protection mode select 00: pwm output control disabled / port output = all phases high-z 01: all upper phases on, all lower phases o ff / port output = lower phases high-z 10: all upper phases off, all lower phases on / port output = upper phases high-z 11: all phases off / port output = all phases high-z ? on = pwm output (no output control), off = low [when , = 1 (active high)] this field controls pwm output and port output of the upper and lower phases in case of an emergency. 2 - r/w read as "0". 1 emgrs w emg protection release 0: - 1: release protection emg protection can be released by setting the pmd1mdout register to 0 and then setting the bit to 1. this bit is always read as 0. ? pmd1mdout register be sure to write 0 to both the upper bits [10:8] and lower bits [5:0]. ? before releasing emg protection, make sure that the pmd1emgsta has returned to high. 0 emgen r/w emg protection circuit enable/disable 0: disable 1: enable the emg protection circuit is enabled by setting this bit to 1. in the initial state, the emg protection circuit is enabled. to disable this circuit, write 0x5a and 0xa5 in this order to the pmd1emgrel register and then clear the emgen bit to 0. (these three in structions must be ex ecuted consecutively.)
page 12-25 TMPM372FWUG 2013/4/15 12.3.6.4 pmd1emgsta (emg status register) 12.3.6.5 ovv protection control circuit (ovv block) the ovv protection control circuit consists of an ovv protection control unit and a port output disable unit. this circuit is activated when the ovv input port is asserted. when the ovv input is asserted (h l) for a specified period (set in ovvcr), the ovv protection circuit fixes the six port output lines in the conduction control circuit to high or low. at this time, an ovv interrupt (intovv) is generated. it is possible to turn off only th e upper or lower phases or all phases. ovv protection is set through the "pmd1ovvcr" . a read value of "1" in pmd1ovvsta indicates that the ovv protection circuit is active. the release of the ovv protectio n state is enabled by setting pmd1ovvcr to "1". then, ovv protection is automatically released after the ovv protection circuit completes its operation. ( the ovv protection state is not released while the ovv protection input is low. the state of this port input can be checked by r eading pmd1ovvsta. ) the ovv protection state is releas ed in synchronization with the pwm period (when the pwm count matches the value. when 0.5 pwm peri od is selected, the release timing is when the pwm counter equals 1 or .). to disable the ovv protection function, write "0x5a" and "0xa5" in this order to the and then clear pmd1ovvcr to 0. (these three instructions must be executed consecutively.) the ovv protection circuit can be disabled only after the specified key codes ("0x5a", "0xa5") are written in the register to pr event it from being inadvertently disabled. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------emgiemgst after reset000000 - 0 bit bit symbol type function 31-2 - r read as 0. 1emgi remg input emg protection state the emg input state can be known by reading this bit 0 emgst r emg protection state 0: normal operation 1: protected the emg protection state can be known by reading this bit.
page 12-26 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.6.6 pmd1ovvcr (ovv control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol---- ovvcnt after reset00000000 7 6 5 4 3 2 1 0 bit symbol - adin1en adin0en ovvmd ovvisel ovvrs ovven after reset00000000
page 12-27 TMPM372FWUG 2013/4/15 bit bit symbol type function 31-12 - r read as 0. 11-8 ovvcnt[3:0] r/w ovv input detection time ovvcnt = 1 to 15 (if 0 is set, it is handled as 1.) ovvcnt 16/fsys (resolution: 200[nsec] at 80 mhz ) ? ovvcnt is effective only when port input is selected as the ovv signal ( = "1"). 7 - r read as 0. 6 adin1en r/w adc b monitor interrupt input enable 0: disable input 1: enable input this bit selects whether to enable or disable the monitor signal input from adc b. when this bit is set to enable and ="1", the pmd is placed in a protection state (if ovv protec- tion is enabled) by an interrupt signal from adc b that is generated by a match between an ad conversion result and the specified compare value. ? for details, see the chapter on the adc. 5 adin0en r/w adc a monitor interrupt input enable 0: disable 1: enable this bit selects whether to enable or disable the monitor signal input from adc a. when this bit is set to enable and ="1", the pmd is placed in a protection state (if ovv protec- tion is enabled) by an interrupt signal from adc a that is generated by a match between an ad conversion result and the specified compare value. ? for details, see the chapter on the adc. 4-3 ovvmd[1:0] r/w ovv protection mode 00: no output control 01: all upper phases on, all lower phases off 10: all upper phases off, all lower phases on 11: all phases off (on = high, off = low [when , = 1 (active high)]) this field controls the outputs of the upper and lower phases when an ovv condition occurs. ? if ovv and emg conditions occur simultaneously, the protection mode settings in the register become effective. 2 ovvisel r/w ovv input select 0: port input 1: adc monitor signal this bit selects whether to use port input or the monitor signal from the adc as the ovv signal to be input to the protection circuit. ? when the adc monitor signal is selected, becomes invalid. 1 ovvrs r/w ovv protection release 0: disable automatic release of ovv protection 1: enable automatic release of ovv protection the ovv protection state is entered when the overvo ltage detection signal makes a high-to-low transition. after the overvoltage detection signal returns high, th e ovv protection state can be automatically released by a match between the pwm counter and the ) register by setting this bit to "1". ? when 0.5 pwm period is selected (pmd1mdcr = "00"), the ovv protection state is released when the pwm counter equals "1" or . 0 ovven r/w ovv protection circuit enable/disable 0: disable 1: enable the ovv protection circuit is en abled by setting this bit to 1. in the in itial state, the ovv protection circuit is disabled. to disable this circuit, write "0x5a" and "0xa5" in this order to the register and then clear bit to "0". (these three instructions must be executed consecutively.)
page 12-28 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.6.7 pmd1ovvsta (ovv status register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------ovviovvst after reset000000 - 0 bit bit symbol type function 31-2 - r read as 0. 1 ovvi r ovvi input ovvi state the ovv input state (selected by ovvcr) can be known by reading this bit. 0 ovvst r ovv protection state 0: normal operation 1: protected the ovv state can be known by reading this bit.
page 12-29 TMPM372FWUG 2013/4/15 12.3.7 dead time circuit figure 12-7 dead time circuit the dead time circuit consists of a dead time unit and an output polarity switching unit. for each of the u, v and w phases, the on delay circ uit introduces a delay (dead time) when the upper and lower phases are switched to prevent a short circuit. the dead time is set to the dead time register (pmd1dtr)as an 8-bit value with a resolution of 100 ns at 80 mhz. the output polarity switching circuit allows the polarity (active high or active low) of the upper and lower phases to be independently set through pmd1mdpot and . on delay circuit on delay circuit on delay circuit x? u? y? v? z? w? x u y v z w fsys/8 pmd1dtr pmd1mdpot pmd1mdpot
page 12-30 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.7.1 pmd1dtr (dead time register ) note: do not change register while pmd1mden = 1. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol dtr after reset00000000 bit bit symbol type function 31-8 - r read as 0. 7-0 dtr[7:0] r/w dead time the dead time value can be calculated by following formula. 100 nsec (up to 25.5 sec at fsys = 80 mhz)
page 12-31 TMPM372FWUG 2013/4/15 12.3.8 sync trigger generation circuit figure 12-8 sync tri gger generation circuit the sync trigger generation circuit generates trigger signals for starting adc sampling in synchronization with pwm. the adc trigger signal (pmdtrg) is generated by a match between pmd1mdcnt and pmd1trgcmp. the signal generation timing can be selected from up-count match, down-count match and up-/down-count match. when the edge-aligned pwm mode is selected, the adc trigger signal is generated on an up-count match. when pwm output is disabled (pmd1mden = 0), trigger output is also dis- abled. when the trigger select output mode is selected, the trigger output po rt is switched according to the pmd1trgsel register setting or s ector information from the vector engine. buffer buffer a=b a=b trg1 trg0 slope select pmdtrg0 pmdtrg1 up down ptenc pwm sync signal trigger output select a=b a=b ve : vtrgcmp0 ve : vtrgcmp1 buffer buffer trg2 trg3 sector infomation pmdtrg2 pmdtrg3 pmdtrg4 pmdtrg5 pwm sync signal pmd counter pmd1modsel pmd1trgcmp0 pmd1trgcmp1 pmd1trgcmp2 pmd1trgcmp3 pmd1trgcr pmd1trgmd pmd1mdcnt
page 12-32 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.8.1 pmd1trgcmp0 (trigger compare registers 0) note 1: to load the data in trgcmp0 and trgcmp1 to the second buffers, select the bus mode (default) by setting pm d1modesel to "0". note 2: do not write to these registers in byte units. if the upper 8 bits [15:8] and the lower 8 bits [7:0] are written separately, operation cannot be guaranteed. note 3: when is set to 0x0001, no trigger output is made only in the first cycle after pwm start ( = 1). 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol trgcmp0 after reset00000000 7 6 5 4 3 2 1 0 bit symbol trgcmp0 after reset00000000 bit bit symbol type function 31-16 - r read as 0. 15-0 trgcmp0 [15:0] r/w trigger output compare registers when the pmd counter value matches the value set in trgcmp0, pmdtrg is output. when trgcmp0 is read, the value in the first buffe r of the double buffers (data set via the bus) is returned. trgcmp0 should be set in a range of 1 to [ set value ? 1]. it is prohibited to set to 0 or the value.
page 12-33 TMPM372FWUG 2013/4/15 12.3.8.2 pmd1trgcmp1 (trigger compare registers1) note 1: to load the data in trgcmp0 and trgcmp1 to the second buffers, select the bus mode (default) by setting modesel pmd1modesel to 0. note 2: do not write to these registers in byte units. if the upper 8 bits [15:8] and the lower 8 bits [7:0] are written separately, operation cannot be guaranteed. note 3: when is set to 0x0001, no trigger output is made only in the first cycle after pwm start (mden = 1). 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol trgcmp1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol trgcmp1 after reset00000000 bit bit symbol type function 31-16 - r read as 0. 15-0 trgcmp1 [15:0] r/w trigger output compare registers when the pmd counter value matches the value set in trgcmp1, pmdtrg is output. when trgcmp1 is read, the value in the first buffe r of the double buffers (data set via the bus) is returned. trgcmp1 should be set in a range of 1 to [ set value = 1]. it is prohibited to set to 0 or the value.
page 12-34 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.8.3 pmd1trgcmp2 (trigger compare registers 2) note 1: do not write to these registers in byte units. if the upper 8 bits [15:8] and the lower 8 bits [7:0] are written separately, operation cannot be guaranteed. note 2: when is set to "0x0001", no trigger output is made only in the first cycle after pwm start (mden = "1"). 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol trgcmp2 after reset00000000 7 6 5 4 3 2 1 0 bit symbol trgcmp2 after reset00000000 bit bit symbol type function 31-16 - r read as 0. 15-0 trgcmp2 [15:0] r/w trigger output compare registers when the pmd counter value matches the value set in trgcmp2, pmdtrg is output. when trgcmp2 is read, the value in the first buffe r of the double buffers (data set via the bus) is returned. trgcmp2 should be set in a range of 1 to [ set value ? 1]. it is prohibited to set to 0 or the value.
page 12-35 TMPM372FWUG 2013/4/15 12.3.8.4 pmd1trgcmp3 (trigger compare registers 3) note 1: do not write to these registers in byte units. if the upper 8 bits [15:8] and the lower 8 bits [7:0] are written separately, operation cannot be guaranteed. note 2: when is set to "0x0001", no trigger output is made only in the first cycle after pwm start ( = 1). update timing of the trigger compare register (trgcmpx) the trigger compare register (trg cmpx) is double-buffered. the timing at which the data written to trgcmpx is loaded to the second buffer depends on the setting of pmd1trgcr. when pmd1trgcr is set to "1", data wr itten to trgcmpx is immediately loaded to the second buffer. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol trgcmp3 after reset00000000 7 6 5 4 3 2 1 0 bit symbol trgcmp3 after reset00000000 bit bit symbol type function 31-16 - r read as 0. 15-0 trgcmp3 [15:0] r/w trigger output compare registers when the pmd counter value matches the value set in trgcmp3, pmdtrg is output. when trgcmp3 is read, the value in the first buffe r of the double buffers (data set via the bus) is returned. trgcmp3 should be set in a range of 1 to [ set value ? 1]. it is prohibited to set trgcmp3 to 0 or the value. table 12-4 trgcmpx buffer update timing according to trigge r output mode setting setting tbufx update timing 000: trigger output disabled always updated 001: trigger output on down-count match updated when pwm counter equals mdprd (pwm carrier peak) 010: trigger output on up-count match updated when pwm counter equals "1" (pwm carrier bottom) 011: trigger output on up-/down-count match updated when pwm counter equals "1" or mdprd (pwm carrier peak/bottom) 100: trigger output at pwm carrier peak always updated 101: trigger output at pwm carrier bottom 110: trigger output at pwm carrier peak/bottom 111: trigger output disabled
page 12-36 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.8.5 pmd1trgcr (trigger control register ) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol trg3be trg3md trg2be trg2md after reset00000000 7 6 5 4 3 2 1 0 bit symbol trg1be trg1md trg0be trg0md after reset00000000
page 12-37 TMPM372FWUG 2013/4/15 bit bit symbol type function 31-16 - r read as 0. 15 trg3be r/w pmdtrg3 buffer update timing 0: sync 1: async (the value written to pmdtrg3 is immediately reflected.) this bit enables asyn chronous updating of the pmdtrg3 buffers. 14-12 trg3md[2:0] r/w pmdtrg3 mode setting 000: trigger output disabled 001: trigger output at down-count match 010: trigger output at up-count match 011: trigger output at up-/down-count match 100: trigger output at pwm carrier peak 101: trigger output at pwm carrier bottom 110: trigger output at pwm carrier peak/bottom 111: trigger output disabled this register selects trigger output timing. when the pmd1mdcr is set to the edge-aligned mode, trigger outputs are made on up-count match or at pwm carrier peak even if down-co unt match or pwm carrier bottom is selected. ? when ="011", pmd1trgcmp3="0 x0001" and pmd1mdcr="1" (triangular wave), one trigger output is made per period. 11 trg2be r/w pmdtrg2 buffer update timing 0: sync 1: async (the value written to pmdtrg2 is immediately reflected.) this bit enables asyn chronous updating of the pmdtrg2 buffers. 10-8 trg2md[2:0] r/w pmdtrg2 mode setting 000: trigger output disabled 001: trigger output at down-count match 010: trigger output at up-count match 011: trigger output at up-/down-count match 100: trigger output at pwm carrier peak 101: trigger output at pwm carrier bottom 110: trigger output at pwm carrier peak/bottom 111: trigger output disabled this register selects trigger output timing. when the pmd1mdcr is set to the edge-aligned mode, trigger outputs are made on up-count match or at pwm carrier peak even if down-co unt match or pwm carrier bottom is selected. ? when ="011", pmd1trgcmp2="0 x0001" and pmd1mdcr="1" (triangular wave), one trigger output is made per period. 7 trg1be r/w pmdtrg1 buffer update timing 0: sync 1: async (the value written to pmdtrg1 is immediately reflected.) this bit enables asyn chronous updating of the pmdtrg1 buffers. 6-4 trg1md[2:0] r/w pmdtrg1 mode setting 000: trigger output disabled 001: trigger output at down-count match 010: trigger output at up-count match 011: trigger output at up-/down-count match 100: trigger output at pwm carrier peak 101: trigger output at pwm carrier bottom 110: trigger output at pwm carrier peak/bottom 111: trigger output disabled this register selects trigger output timing. when the pmd1mdcr is set to the edge-aligned mode, trigger outputs are made on up-count match or at pwm carrier peak even if down-co unt match or pwm carrier bottom is selected. ? when ="011", pmd1trgcmp1="0 x0001" and pmd1mdcr="1" (triangular wave), one trigger output is made per period. 3 trg0be r/w pmdtrg0 buffer update timing 0: sync 1: async (the value written to pmdtrg0 is immediately reflected.) this bit enables asyn chronous updating of the pmdtrg0 buffers.
page 12-38 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 2-0 trg0md[2:0] r/w pmdtrg0 mode setting 000: trigger output disabled 001: trigger output at down-count match 010: trigger output at up-count match 011: trigger output at up-/down-count match 100: trigger output at pwm carrier peak 101: trigger output at pwm carrier bottom 110: trigger output at pwm carrier peak/bottom 111: trigger output disabled this register selects trigger output timing. when the pmd1mdcr is set to the edge-aligned mode, trigger outputs are made on up-count match or at pwm carrier peak even if down-co unt match or pwm carrier bottom is selected. ? when ="011", pmd1trgcmp0="0x0001" and pmd1mdcr="1" (triangular wave), one trigger output is made per period. bit bit symbol type function
page 12-39 TMPM372FWUG 2013/4/15 12.3.8.6 pmd1trgmd (trigger output mode setting register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------trgoutemgtge after reset00000000 bit bit symbol type function 31-2 - r read as 0. 1 trgout r/w trigger output mode 0: fixed trigger output 1: variable trigger output when ="0", trigger outputs pmdtrg0 to pmdtrg3 output the trigger signals generated by a match with to respective ly. pmdtrg4 and pmdtrg5 are fixed to a low level. when ="1", trigger output by pmd1trgcmp0 is switched according to the set- ting or sector information from the vector engine. for details, see the table below. 0 emgtge r/w output enable in emg protection state 0: disable trigger output in the protection state 1: enable trigger output in the protection state this bit enables or disables trigge r output in the emg protection state. table 12-5 trigger output patterns setting compare register setting trigger output =0 pmd1trgcmp0 pmdtrg0 pmd1trgcmp1 pmdtrg1 pmd1trgcmp2 pmdtrg2 pmd1trgcmp3 pmdtrg3 =1 pmd1trgcmp0 0p m d t r g 0 1p m d t r g 1 2p m d t r g 2 3p m d t r g 3 4p m d t r g 4 5p m d t r g 5 pmd1trgcmp1 no trigger output pmd1trgcmp2 no trigger output pmd1trgcmp3 no trigger output
page 12-40 12. motor contro l circuit (pmd: pr ogrammable motor driver) 12.3 pmd registers TMPM372FWUG 2013/4/15 12.3.8.7 pmd1trgsel (trigger output select register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol----- trgsel after reset00000000 bit bit symbol type function 31-2 - r read as 0. 2-0 trgsel[2:0] r/w trigger output select 000: output from pmdtrg0 001: output from pmdtrg1 010: output from pmdtrg2 011: output from pmdtrg3 100: output from pmdtrg4 101: output from pmdtrg5 110: no trigger output 111: no trigger output this field is effective when the variable trigger ou tput mode is selected (pmd1trgmd="1"). the selected trigger is output by a match between the pmd counter and the pmd1trgcmp0 value. (see table 12-5.)
page 13-1 TMPM372FWUG 2013/4/15 13. vector engine (ve) 13.1 overview 13.1.1 features the vector engine provides the following features: 1. executes basic tasks for vector control (coordin ate conversion, phase conversion and sin/coscom- putation). uses fixed-point format data. no need for software to mana ge the decimal point alignment. 2. enables interface (output control, trigger generation, inpu t processing) with the motor control circuit (pmd: programmable motor driver) and ad converter (adc). ? converts computation results from fixed-point format to data format usable in the pmd. ? generates timing data for interactive operation with the pmd and adc. ? converts ad conversion results into fixed-point format. 3. calculates current, volt age and rotation speed by using normalized values with respect to their maxi- mum values in fixed-point format. 4. implements pi control in current control. 5. implements phase interpolation (integration of rotation speed). figure 13-1 block diagram of vector control pi control current control pi control idref iqref coordinate conversion dqab phase conversion 23 (svm) vd vq va vb sin/cos computasion phase interpolation coordinate conversion dqab sin cos phase conversion 23 input processing vdc iu iv iw ia ib vdc id iq id iq current/voltage detection (adc) output control trigger generation pwm output setting (pmd) sync. trigger setting (pmd) dutya dutyb dutyc sector sin,cos
page 13-2 13. vector engine (ve) 13.2 configuration TMPM372FWUG 2013/4/15 13.1.2 key specifications 1. space vector conversion is used for 2-phase-to-3-phase conversion . both 2-phase modulation and 3- phase modulation are supported. 2. adc sampling timing can be generated for sensorless current detection. current detection can be per- formed by the 1-shunt, 3-s hunt and 2-sensor methods. 3. in current control, pi control is implemented independ ently for d-axis and q-axis. it is also possible to directly supply reference voltage info rmation without using current control. 4. sin/cos computations are performed wi th approximations using series values. 5. phase information can be directly specified or computed from rotation speed by using phase interpo- lation. note 1: for using the vector engine, the pmd must be set to the ve mode through the mode select register (pmd1modesel). note 2: it is also necessary to make appropriate settings in the adc (enabling trigger and selecting ain and result registers to be used) for each sy nchronizing trigger from the pmd. 13.2 configuration figure 13-2 shows the configuration of the vector engine. figure 13-2 configuratio n of the vector engine n n n a dc interupt pwm interrupt ve interrupt schedule management schedule control start control error detection interrupt control ta s k s input voltage input processing trigger generation output control output voltage current control schedule 0 schedule 1 schedule 9 scheduler adc pmd computation unit registers decoder
page 13-3 TMPM372FWUG 2013/4/15 13.2.1 interaction among vector engine, motor control circuit and a/d converter as shown in figure 13-3, the vector engine allows direct interaction with the pmd and adc. when the pmd1modesel register is set to the ve mode, the pmd channel 1 registers pmd1cmpu, pmd1cmpv, pmd1cmpw, pmd1mdout, pmd1trgcmp0, pmd1trgcmp1 and pmd1trgsel are switched to the vector engine registers vecm pu1, vecmpv1, vecmpw1, veoutcr1, vetrgcmp01, vetrgcmp11 and vetrgsel1 respectively. in this case, these registers can only be controlled from the vector engine, and cannot be written from the pmd. ot her pmd registers have no read/write restrictions. the adc unit b registers adbreg0, adbreg1, adbreg2, adbreg3 and adabpsetn, , , which are read into the vector engine as the vector engine registers veadreg0b, veadreg1b, veadreg2b, veadreg3b, vephnum0b, vepnnum1b, vephnum2b and vephnum3b respectively. (these reg- isters cannot be accessed from the cpu.) these adc registers can be written and read from the adc.
page 13-4 13. vector engine (ve) 13.2 configuration TMPM372FWUG 2013/4/15 figure 13-3 interaction among vector engine, pmd and adc n n n channel 1 output tasks vetrgcmp01 register vetrgcmp11 register veemgrs1 register vetrgsel1 register vevcmpu1 register vevcmpv1 register vevcmpw1 register veoutcr1 register veadreg0b veadreg1b veadreg2b veadreg3b vephnum0b vephnum1b vephnum2b vephnum3b channel 1 input tasks adbreg1 adbreg0 adbreg2 adbreg3 ad unit b mux mux mux mux mux mux mux mux mux pmd channel 1 trigger generation buffer buffer buffer buffer protection control buffer buffer buffer buffer pwm generation conduction control port output u1 v1 w1 x1 y1 z1 pmd1trg0 to 5 trigger detection monitor function ad conversion analog input ainx vector engine pmd1cmpu pmd1cmpv pmd1cmpw pmd1mdout pmd1emgcr pmd1trgcmp0 pmd1trgcmp1 pmdxtrgcmp2 pmd1trgcmp3 pmd1trgsel pmd1modesel ( n = 0 to 5 )
page 13-5 TMPM372FWUG 2013/4/15 13.3 list of registers the vector engine registers are divided into the following three types: ? ve control registers vector engine control registers and temporary registers ? common registers registers common to both channels ? channel-specific registers computation data and control registers for each channel 13.3.1 list of registers ve control registers register name address ve enable/disable veen r/w 0x4005_0000 cpu start trigger selection vecpuruntrg w 0x4005_0004 task selection vetaskapp r/w 0x4005_0008 operation schedule selection veactsch r/w 0x4005_000c schedule repeat count vereptime r/w 0x4005_0010 start trigger mode vetrgmode r/w 0x4005_0014 error interrupt enable/disable veerrinten r/w 0x4005_0018 ve forced termination vecompend w 0x4005_001c error detection veerrdet r 0x4005_0020 schedule executing flag/executing task veschtaskrun r 0x4005_0024 reserved - r 0x4005_0028 temporary 0 vetmpreg0 r/w 0x4005_002c temporary 1 vetmpreg1 r/w 0x4005_0030 temporary 2 vetmpreg2 r/w 0x4005_0034 temporary 3 vetmpreg3 r/w 0x4005_0038 temporary 4 vetmpreg4 r/w 0x4005_003c temporary 5 vetmpreg5 r/w 0x4005_0040 reserved - r 0x4005_01bc common registers register name address reserved - r/w 0x4005_0174 adc conversion time (based on pwm clock) vetadc r/w 0x4005_0178
page 13-6 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 channel-specific registers for channel 1 register name address status flags vemctlf1 r/w 0x4005_00dc task control mode vemode1 r/w 0x4005_00e0 flow control vefmode1 r/w 0x4005_00e4 pwm period rate (pwm period [s] maximum speed (note1) 2 16 ) setting vetpwm1 r/w 0x4005_00e8 rotation speed (speed [hz] maximum speed(note1) 2 15 ) setting veomega1 r/w 0x4005_00ec motor phase (motor phase [deg]/360 2 16 ) setting vetheta1 r/w 0x4005_00f0 d-axis reference value (current[a] maximum current (note2) 2 15 ) setting veidref1 r/w 0x4005_00f4 q-axis reference value (current[a] maximum current (note2) 2 15 ) setting veiqref1 r/w 0x4005_00f8 d-axis voltage (voltage[v] maximum voltage (note3) 2 31 ) set- ting vevd1 r/w 0x4005_00fc q-axis voltage (voltage[v] maximum voltage (note3) 2 31 ) set- ting vevq1 r/w 0x4005_0100 integral coefficient for pi control of d-axis vecidki1 r/w 0x4005_0104 proportional coefficient for pi control of d-axis vecidkp1 r/w 0x4005_0108 integral coefficient for pi control of q-axis veciqki1 r/w 0x4005_010c proportional coefficient for pi control of q-axis veciqkp1 r/w 0x4005_0110 upper 32 bits of integral term (vdi ) of d-axis voltage vevdih1 r/w 0x4005_0114 lower 32 bits of integral term (vdi) of d-axis voltage vevdilh1 r/w 0x4005_0118 upper 32 bits of integral term (vqi) of q-axis voltage vevqih1 r/w 0x4005_011c lower 32 bits of integral term (vqi) of q-axis voltage vevqilh1 r/w 0x4005_0120 switching speed (for 2-phase modulation and shift pwm) vefpwmchg1 r/w 0x4005_0124 pwm period (to be set identically with pmd?s pwm period) vemdprd1 r/w 0x4005_0128 minimum pulse width veminpls1 r/w 0x4005_012c synchronizing trigger correcti on value vetrgcrc1 r/w 0x4005_0130 reserved - r/w 0x4005_0134 cosine value at theta for output conversion (q15 data) vecos1 r/w 0x4005_0138 sine value at theta for output conversion (q15 data) vesin1 r/w 0x4005_014c previous cosine value for input processing (q15 data) vecosm1 r/w 0x4005_0140
page 13-7 TMPM372FWUG 2013/4/15 note 1: maximum speed: maximum rotation speed [hz] that can be controlled or operated. note 2: maximum current:(phase current value [a] which corresponds to 1 lsb of ad converter) 2 11 note 3: maximum voltage: (supply voltage (vdc) value [v] which corresponds to 1 lsb of ad conveter) 2 12 note 4: ad conversion results are stored in the upper 12 bits of each 16-bit register. previous sine value for input processing (q15 data) vesinm1 r/w 0x4005_0144 sector information vesector1 r/w 0x4005_0148 previous sector information for input processing vesectorm1 r/w 0x4005_014c ad conversion result of a-phase zero-current (note4) veiao1 r/w 0x4005_0150 ad conversion result of b-phase zero-current (note4) veibo1 r/w 0x4005_0154 ad conversion result of c-phase zero-current (note4) veico1 r/w 0x4005_0158 ad conversion result of a-phase current (note4) veiaadc1 r/w 0x4005_015c ad conversion result of b-phase current (note4) veibadc1 r/w 0x4005_0160 ad conversion result of c-phase current (note4) veicadc1 r/w 0x4005_0164 dc supply voltage (voltage[v] maximum voltage (note3) 2 15 ) vevdc1 r/w 0x4005_0168 d-axis current (current[a] maximum current (note2) 2 31 ) veid1 r/w 0x4005_016c q-axis current (current[a] maximum current (note2) 2 31 ) veiq1 r/w 0x4005_0170 pmd control: cmpu setting vecmpu1 r/w 0x4005_019c pmd control: cmpv setting vecmpv1 r/w 0x4005_01a0 pmd control: cmpw setting vecmpw1 r/w 0x4005_01a4 pmd control: output control (mdout) veoutcr1 r/w 0x4005_01a8 pmd control: trgcmp0 setting vetrgcmp01 r/w 0x4005_01ac pmd control: trgcmp1 setting vetrgcmp11 r/w 0x4005_01b0 pmd control: trigger selection vetrgsel1 r/w 0x4005_01b4 pmd control: emg return veemgrs1 w 0x4005_01b8 channel-specific registers for channel 1 register name address
page 13-8 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.2 ve control registers 13.3.2.1 veen (ve enable/disable register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------veidlenveen after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1 veidlen r/w controls whether or not the clock is supplied to the vector engine in idle mode. 0: inactive 1: active 0 veen r/w disables or enables the vector engine. 0: disable 1: enable
page 13-9 TMPM372FWUG 2013/4/15 13.3.2.2 vecpuruntrg (cpu start trigger selection register) note 1: when "1" is written to these bits, it is cleared in the next cycle. thes e bits always read as 0. note 2: the task to be performed is determined by the settings of the veactsch and vetaskapp regis- ters. note 3: if a channel under executing will be restarted, it must be terminated by vecompend register before a start command executed. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------vcpurtb- after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1 vcpurtb w starts channel 1 by programming. 0: - 1: start 0 ? w always write "0" to bit0.
page 13-10 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.2.3 vetaskapp(task selection register) note: only those tasks that are in cluded in schedules can be specified. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol vtaskb - after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-4 vtaskb[3:0] r/w channel 1 task selection 0x0 : output control 0x1 : trigger generation 0x2 : input processing 0x3 : input phase conversion 0x4 : input coordina te axis conversion 0x5 : current control 0x6 : sin/cos computation 0x7 : output coordi nate axis conversion 0x8 : output phase conversion 0x9 -0xf : reserved specifies the task to be performed when channel 1 is started by programming. 3-0 ? r/w always write "0x0".
page 13-11 TMPM372FWUG 2013/4/15 13.3.2.4 veactsch (operation schedule selection register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol vactb - after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-4 vactb[3:0] r/w specifies an individual task execution or a schedule for channel 1. 0x0 : individual task execution 0x1 : schedule 1 0x4 : schedule 4 0x9 : schedule 9 other : reserved 3-0 ? r/w always write "0x0".
page 13-12 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.2.5 vereptime (schedule repeat count) note: when "0" is set, no schedule is executed. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol vrepb - after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-4 vrepb[3:0] r/w specifies the repeat times a sc hedule is to be executed in channel 1. 0: do not execute schedule 1 to 15: execute schedule a specified number of times 3-0 ? r/w always write "0x0".
page 13-13 TMPM372FWUG 2013/4/15 13.3.2.6 vetrgmode (start trigger mode) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol---- vtrgb - after reset00000000 bit bit symbol type function 31-4 ? r read as 0. 3-2 vtrgb[1:0] r/w specifies the ad conversion end inte rrupt that triggers input processing in channel 1. channel 1 trigger mode 00: ignore both intb0(unit a) and intb1(unit b) 01: start by intb0 (unit a) 10: start by intb1 (unit b) 11: start when both intb0 (unit a) and intb1 (unit b) occur 1-0 ? r/w always write "0x0".
page 13-14 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.2.7 veerrinten (error interrupt enable/disable) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------verrenb- after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1 verrenb r/w enables or disables the error detection interrupt in channel 1. 0: disable 1: enable 0 ? r/w always write "0".
page 13-15 TMPM372FWUG 2013/4/15 13.3.2.8 vecompend (ve forced termination) note: when "1" is written to these bits, it is cleared in the next cycle. these bits always read as "0". 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------vcendb- after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1 vcendb w forcefully terminates the cu rrently executing schedule in channel 1. 0: ? 1: terminate 0 ? w always write "0".
page 13-16 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.2.9 veerrdet (error detection) note 1: the error flags are set when a pwm interrupt is detected during execution of a schedule (excluding standby periods waiting for a start trigger). note 2: the error flags are cleared by a read of this register. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol------verrdb- after reset00000000 bit bit symbol type function 31-2 ? r read as 0. 1 verrdb r channel 1 error flag 0: no error detected 1: error detected 0 ? r always write "0".
page 13-17 TMPM372FWUG 2013/4/15 13.3.2.10veschtaskrun (schedule executing flag/executing task) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol------ vrtaskb after reset00000000 7 6 5 4 3 2 1 0 bit symbol vrtaskb vrschb - - after reset00000000 bit bit symbol type function 31-10 ? r read as 0. 9-6 vrtaskb[3:0] r task number currently executing in channel 1 0x0: output control 0x1: trigger generation 0x2: input processing 0x3: input phase conversion 0x4: input coordinat e axis conversion 0x5: current control 0x6: sin/cos computation 0x7: output coordinate axis conversion 0x8: output phase conversion 0x9 to 0xf: reserved 5 vrschb r schedule execution status in channel 1 0: not executing 1: executing 4-0 ? r read as 0.
page 13-18 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.2.11vetmpreg0 (temporary register 0) 13.3.2.12vetmpreg1 (temporary register 1) 31 30 29 28 27 26 25 24 bit symbol tmpreg0 after reset00000000 23 22 21 20 19 18 17 16 bit symbol tmpreg0 after reset00000000 15 14 13 12 11 10 9 8 bit symbol tmpreg0 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tmpreg0 after reset00000000 bit bit symbol type function 31-0 tmpreg0[31:0] r/w temporary register 0 31 30 29 28 27 26 25 24 bit symbol tmpreg1 after reset00000000 23 22 21 20 19 18 17 16 bit symbol tmpreg1 after reset00000000 15 14 13 12 11 10 9 8 bit symbol tmpreg1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tmpreg1 after reset00000000 bit bit symbol type function 31-0 tmpreg1[31:0] r/w temporary register 1
page 13-19 TMPM372FWUG 2013/4/15 13.3.2.13vetmpreg2 (temporary register 2) 13.3.2.14vetmpreg3 (temporary register 3) 31 30 29 28 27 26 25 24 bit symbol tmpreg2 after reset00000000 23 22 21 20 19 18 17 16 bit symbol tmpreg2 after reset00000000 15 14 13 12 11 10 9 8 bit symbol tmpreg2 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tmpreg2 after reset00000000 bit bit symbol type function 31-0 tmpreg2[31:0] r/w temporary register 2 31 30 29 28 27 26 25 24 bit symbol tmpreg3 after reset00000000 23 22 21 20 19 18 17 16 bit symbol tmpreg3 after reset00000000 15 14 13 12 11 10 9 8 bit symbol tmpreg3 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tmpreg3 after reset00000000 bit bit symbol type function 31-0 tmpreg3[31:0] r/w temporary register 3
page 13-20 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.2.15vetmpreg4 (temporary register 4) 13.3.2.16vetmpreg5 (temporary register 5) 31 30 29 28 27 26 25 24 bit symbol tmpreg4 after reset00000000 23 22 21 20 19 18 17 16 bit symbol tmpreg4 after reset00000000 15 14 13 12 11 10 9 8 bit symbol tmpreg4 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tmpreg4 after reset00000000 bit bit symbol type function 31-0 tmpreg4[31:0] r/w temporary register 4 31 30 29 28 27 26 25 24 bit symbol tmpreg5 after reset00000000 23 22 21 20 19 18 17 16 bit symbol tmpreg5 after reset00000000 15 14 13 12 11 10 9 8 bit symbol tmpreg5 after reset00000000 7 6 5 4 3 2 1 0 bit symbol tmpreg5 after reset00000000 bit bit symbol type function 31-0 tmpreg5[31:0] r/w temporary register 5
page 13-21 TMPM372FWUG 2013/4/15 13.3.3 common registers 13.3.3.1 vetadc (common adc conversion time) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol tadc after reset00000000 7 6 5 4 3 2 1 0 bit symbol tadc after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 tadc[15:0] r/w adc conversion time (based on pwm clock) 0x0000 to 0xffff : (adc conversion time[s] pwm counter clock frequency[s]) note) this register is effective when the 1-shunt current detection mode is selected and pwm shift is enabled.
page 13-22 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4 channel-specific registers 13.3.4.1 vemode1 (task control mode registers) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol---- ocrmd zienpvien after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-4 ? r/w always write "0". 3-2 ocrmd[1:0] r/w output control 00: output off 01: output enable 10: reserved 11: output off and emg return 1 zien r/w zero-current detection 0: disable 1: enable 0 pvien r/w phase interpolation 0: disable 1: enable
page 13-23 TMPM372FWUG 2013/4/15 13.3.4.2 vefmode1(flow control register) note: when the 1-shunt mode is used, t he acceptable pmdtrg is as follows. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol------mregdis- after reset00000000 7 6 5 4 3 2 1 0 bit symbol adcsel - pmdsel idmode spwmen c2pen after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-10 ? r/w always write "0". 9 mregdis r/w keep the previous value of sin/cos/sector 0: effective 1: no_effective in case of no_effective, vesinm1=vesin1, vecosm1=vecos1, vesectorm1=vesector1. 8 ? r/w always write "0". 7-4 ? r/w always write "0". 3-2 idmode r/w current detection mode 00: 3-shunt 01: 2-sensor 10: 1-shunt (for up count pmdtrg) 11: 1-shunt (for down count pmdtrg) 1 spwmen r/w enables or disables pwm shift. 0: disable 1: enable 0 c2pen r/w selects 3-phase or 2-phase modulation. 0: 3-phase modulation 1: 2-phase modulation vefmode1 pmd1trgcr pmd1trgcr 10 010(up-count) 010(up-count) 10 101(carrier bottom) 010(up-count) 11 001 (down-count) 001 (down-count) 11 001 (down-count) 101(carrier bottom)
page 13-24 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.3 vetpwm1(pwm period rate control register) 13.3.4.4 veomega1(rotation speed control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol tpwm after reset00000000 7 6 5 4 3 2 1 0 bit symbol tpwm after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 tpwm[15:0] r/w set a pwm period rate (it is valid when the phase interpolation is enabled,16-bit fixed-point data: 0.0 to 1.0) as follows: 0x0000 to 0xffff : pwm period [s] max_hz 2 16 (max_hz : maximum rotation speed [hz]) (it indicates a ratio between pwm frequency and maximum rotation speed.) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol omega after reset00000000 7 6 5 4 3 2 1 0 bit symbol omega after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 omega[15:0] r/w set a rotation speed (16-bit fixed-point data: -1.0 to 1.0) as follows: 0x0000 to 0xffff : rotation speed [hz] max_hz 2 15 (max_hz : maximum rotation speed [hz])
page 13-25 TMPM372FWUG 2013/4/15 13.3.4.5 vetheta1(motor phase control register) 13.3.4.6 vecos1/vesin1/vecosm1/vesinm1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol theta after reset00000000 7 6 5 4 3 2 1 0 bit symbol theta after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 theta[15:0] r/w set phase data (16-bit fixed-point data: 0.0 to 1.0) as follows: formula : phase[deg] 360 2 16 vecos1 (cosine value at theta for output conversion (q15 data)) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol cos after reset00000000 7 6 5 4 3 2 1 0 bit symbol cos after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 cos[15:0] r/w cosine value based on the theta value (16-bit fixed-point data: -1.0 to 1.0) cosine value: 0x0000 to 0xffff
page 13-26 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 vesin1 (sine value at theta for output conversion (q15 data)) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol sin after reset00000000 7 6 5 4 3 2 1 0 bit symbol sin after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 sin[15:0] r/w sine value based on the theta value (16-bit fixed-point data: -1.0 to 1.0) sine value: 0x0000 to 0xffff vecosm1 (previous cosine value for input processing (q15 data)) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol cosm after reset00000000 7 6 5 4 3 2 1 0 bit symbol cosm after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 cosm[15:0] r/w previous value of the cos register cosine value (previous value): 0x0000 to 0xffff
page 13-27 TMPM372FWUG 2013/4/15 vesinm1 (previous sine value for input processing (q15 data)) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol sinm after reset00000000 7 6 5 4 3 2 1 0 bit symbol sinm after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 sinm[15:0] r/w previous value of the sin register sine value (previous value): 0x0000 to 0xffff
page 13-28 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.7 veidref1/veiqref1(dq current reference registers) veidref1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol idref after reset00000000 7 6 5 4 3 2 1 0 bit symbol idref after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 idref[15:0] r/w reference value of d-axis cu rrent (16-bit fixed-point data: -1.0 to 1.0) 0x0000 to 0xffff(the value to be set is : d-axis current reference[a] max_i 2 15 ) max_i: (phase current value [a] which corresponds to 1 lsb of adc) 2 11 veiqref1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol iqref after reset00000000 7 6 5 4 3 2 1 0 bit symbol iqref after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 iqref[15:0] r/w reference value of q-axis current (16-bit fixed-point data: -1.0 to 1.0) 0x0000 to 0xffff(the value to be set is : q-axis current reference [a] max_i 2 15 ) max_i: (phase current value [a] which corresponds to 1 lsb of adc) 2 11
page 13-29 TMPM372FWUG 2013/4/15 13.3.4.8 vevd1/vevq1(d-axis/q-axis voltage registers) vevd1 31 30 29 28 27 26 25 24 bit symbol vd after reset00000000 23 22 21 20 19 18 17 16 bit symbol vd after reset00000000 15 14 13 12 11 10 9 8 bit symbol vd after reset00000000 7 6 5 4 3 2 1 0 bit symbol vd after reset00000000 bit bit symbol type function 31-0 vd[31:0] r/w d-axis voltage (32-bit fixed-point data: -1.0 to 1.0) 0x0000_0000 to 0xffff_ffff(d-axis voltage max_v 2 31 ) max_v: (supply voltage (vdc) value [v] which corresponds to 1 lsb of adc) 2 12 vevq1 31 30 29 28 27 26 25 24 bit symbol vq after reset00000000 23 22 21 20 19 18 17 16 bit symbol vq after reset00000000 15 14 13 12 11 10 9 8 bit symbol vq after reset00000000 7 6 5 4 3 2 1 0 bit symbol vq after reset00000000 bit bit symbol type function 31-0 vq[31:0] r/w q-axis voltage (32-bit fixed-point data: -1.0 to 1.0) 0x0000_0000 to 0xffff_ffff(q-axis voltage max_v 2 31 ) max_v: (supply voltage (vdc) value [v] which corresponds to 1 lsb of adc) 2 12
page 13-30 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.9 vecidki1/vecidkp1/vevciqki1/veci qkp1(pi control coefficient registers) vecidki1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol cidki after reset00000000 7 6 5 4 3 2 1 0 bit symbol cidki after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 cidki[15:0] r/w integral coefficient for pi control of d-axis: 0x0000 to 0xffff vecidkp1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol cidkp after reset00000000 7 6 5 4 3 2 1 0 bit symbol cidkp after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 cidkp[15:0] r/w propo rtional coefficient for pi cont rol of d-axis: 0x0000 to 0xffff
page 13-31 TMPM372FWUG 2013/4/15 vevciqki1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol ciqki after reset00000000 7 6 5 4 3 2 1 0 bit symbol ciqki after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 ciqki[15:0] r/w integral coefficient for pi control of q-axis: 0x0000 to 0xffff veciqkp1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol ciqkp after reset00000000 7 6 5 4 3 2 1 0 bit symbol ciqkp after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 ciqkp[15:0] r/w proportional coefficient for pi control of q-axis: 0x0000 to 0xffff
page 13-32 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.10vevdih1/vevdilh1/vevqih1/vevqilh1 (pi control integral term registers) note: 64-bit fixed-point data with 63 fractional bits (-1.0 to 1.0) vevdih1 31 30 29 28 27 26 25 24 bit symbol vdih after reset00000000 23 22 21 20 19 18 17 16 bit symbol vdih after reset00000000 15 14 13 12 11 10 9 8 bit symbol vdih after reset00000000 7 6 5 4 3 2 1 0 bit symbol vdihi after reset00000000 bit bit symbol type function 31-0 vdih[31:0] r/w upper 32 bits of the integral term (vdi) for pi control of d-axis vevdilh1 31 30 29 28 27 26 25 24 bit symbol vdilh after reset00000000 23 22 21 20 19 18 17 16 bit symbol vdilh after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------- after reset00000000 bit bit symbol type function 31-16 vdilh[15:0] r/w bit 31 to 16 of the integral term (vdi) for pi control of d-axis 15-0 ? r read as 0.
page 13-33 TMPM372FWUG 2013/4/15 note: 64-bit fixed-point data with 63 fractional bits (-1.0 to 1.0) vevqih1 31 30 29 28 27 26 25 24 bit symbol vqih after reset00000000 23 22 21 20 19 18 17 16 bit symbol vqih after reset00000000 15 14 13 12 11 10 9 8 bit symbol vqih after reset00000000 7 6 5 4 3 2 1 0 bit symbol vqih after reset00000000 bit bit symbol type function 31-0 vqih[31:0] r/w upper 32 bits of the integral term (vqi) for pi control of q-axis vevqilh1 31 30 29 28 27 26 25 24 bit symbol vqilh after reset00000000 23 22 21 20 19 18 17 16 bit symbol vqilh after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------- after reset00000000 bit bit symbol type function 31-16 vqilh[15:0] r/w bit 31 to 16 of the integral term (vqi) for pi control of q-axis 15-0 ? r read as 0.
page 13-34 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.11vemctlf1(status flags register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol - - plslfm plslf - lvtf lavfm lavf after reset00000000 bit bit symbol type function 31-8 ? r read as 0. 7-6 ? r/w always write "0". 5 plslfm r/w previous value of 4 plslf r/w minimum disparity of pulse width minimum disparity of pulse width veminpls1 case="0" minimum dispar- ity of pulse width < veminpls1 case ="1" 3 ? r/w always write "0". 2 lvtf r/w supply voltage lower flag vevdc1 0x0100 (1/128) case="0" vevdc1 < 0x0100 (1/128) case="1" 1 lavfm r/w previous value 0 lavf r/w low-speed flag 0: high-speed 1: low-speed veomega1 vefpwmchg1 case="0" veomega1 < vefpwmchg1 case="1"
page 13-35 TMPM372FWUG 2013/4/15 13.3.4.12vefpwmchg1(switching speed (for 2-phase modulation and shift pwm)) 13.3.4.13vemdprd1(pwm period control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol fpwmchg after reset00000000 7 6 5 4 3 2 1 0 bit symbol fpwmchg after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 fpwmchg[15:0] r/w rortation speed when pwm shift is enabled. the value to be set is: rortation speed [hz] max_hz 2 15 (max_hz : maximum rotation speed [hz]) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol vmdprd after reset00000000 7 6 5 4 3 2 1 0 bit symbol vmdprd after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 vmdprd[15:0] r/w pwm period set the value of the pmd?s pmd1mdprd register.
page 13-36 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.14veminpls1(minimum pulse width) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol minpls after reset00000000 7 6 5 4 3 2 1 0 bit symbol minpls after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 minpls[15:0] r/w set the minimum disparity of pulse width among the duty of vecmpu1, vecmpv1, vecmpw1. the value to be set is : disparity of pulse width[s] pwmcounter clock period[s]
page 13-37 TMPM372FWUG 2013/4/15 13.3.4.15vesector1/vesectorm1( sector information register) vesector1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol---- sector after reset00000000 bit bit symbol type function 31-4 ? r read as "0". 3-0 sector[3:0] r/w sector information value : 0x0 to 0xf indicates the rotation position at the time of output by 12 sectors each having 30 degrees. vesectorm1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol---- sectorm after reset00000000 bit bit symbol type function 31-4 ? r read as "0". 3-0 sectorm[3:0] r/w revious sector information. value : 0x0 - 0xf used in input processing.
page 13-38 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.16veiao1/veibo1/veico1(zero-current registers) veiao1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol iao after reset00000000 7 6 5 4 3 2 1 0 bit symbol iao after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 iao[15:0] r/w ad conversion result of a-phase at zero-current. (stores the ad conversion result of a-phase current when the motor is at stop.) veibo1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol ibo after reset00000000 7 6 5 4 3 2 1 0 bit symbol ibo after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 ibo[15:0] r/w ad conversion result of b-phase at zero-current. (stores the ad conversion result of b-phase current when the motor is at stop.)
page 13-39 TMPM372FWUG 2013/4/15 note 1: when the zero-current detection is enabled, ad conversion results are automatically stored to these registers. note 2: ad conversion results are stored in the 15-4 bits, with the 3-0 bits always "0". veico1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol ico after reset00000000 7 6 5 4 3 2 1 0 bit symbol ico after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 ico[15:0] r/w ad conversion result of c-phase at zero-current. (stores the ad conversion result of c-phase current when the motor is at stop.)
page 13-40 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.17veiaadc1/veibadc1/veicadc1(current adc result registers) veiaadc1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol iaadc after reset00000000 7 6 5 4 3 2 1 0 bit symbol iaadc after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 iaadc[15:0] r/w store s the ad conversion result of a-phase current: 0x0000 to 0xffff veibadc1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol ibadc after reset00000000 7 6 5 4 3 2 1 0 bit symbol ibadc after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 ibadc[15:0] r/w store s the ad conversion result of b-phase current: 0x0000 to 0xffff
page 13-41 TMPM372FWUG 2013/4/15 note: ad conversion results are stored in the 15-4 bits, with the 3-0 bits always "0". veicadc1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol icadc after reset00000000 7 6 5 4 3 2 1 0 bit symbol icadc after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 icadc[15:0] r/w stores the ad conversion result of c-phase current: 0x0000 to 0xffff
page 13-42 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.18vevdc1(supply voltage register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol vdc after reset00000000 7 6 5 4 3 2 1 0 bit symbol vdc after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 vdc[15:0] r/w supply voltage (16-bit fixed-point data: 0 to 1.0) value : 0x0000 to 0xffff the actual voltage value is: vdc value max_v value 2 15 max_v : (supply voltage (vdc) value [v] which corresponds to 1 lsb of adc) 2 12
page 13-43 TMPM372FWUG 2013/4/15 13.3.4.19veid1/veiq1(d-axis/q-axis current registers) veid1 31 30 29 28 27 26 25 24 bit symbol id after reset00000000 23 22 21 20 19 18 17 16 bit symbol id after reset00000000 15 14 13 12 11 10 9 8 bit symbol id after reset00000000 7 6 5 4 3 2 1 0 bit symbol id after reset00000000 bit bit symbol type function 31-0 id[31:0] r/w d-axis current (32-bit fixed-point data: -1.0 to 1.0) d-axis current: 0x0000_0000 to 0xffff_ffff the actual current value is: id value max_i value 2 31 max_i : (phase current value [a] which corresponds to 1 lsb of adc) 2 11 veiq1 31 30 29 28 27 26 25 24 bit symbol iq after reset00000000 23 22 21 20 19 18 17 16 bit symbol iq after reset00000000 15 14 13 12 11 10 9 8 bit symbol iq after reset00000000 7 6 5 4 3 2 1 0 bit symbol iq after reset00000000 bit bit symbol type function 31-0 iq[31:0] r/w q-axis current (32-bit fixed-point data: -1.0 to 1.0) q-axis current: 0x0000_0000 to 0xffff_ffff the actual current value is: iq value max_i value 2 31 max_i : (phase current value [a] which corresponds to 1 lsb of adc) 2 11
page 13-44 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.20vecmpu1 / vecmpv1/ vecmpw1(pwm duty register) vecmpu1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol vcmpu after reset00000000 7 6 5 4 3 2 1 0 bit symbol vcmpu after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 vcmpu[15:0] r/w pwm setting of u-phase pwm pulse width of u-phase: 0x0000 to 0xffff vecmpv1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol vcmpv after reset00000000 7 6 5 4 3 2 1 0 bit symbol vcmpv after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 vcmpv[15:0] r/w pwm setting of v-phase pwm pulse width of v-phase: 0x0000 to 0xffff
page 13-45 TMPM372FWUG 2013/4/15 vecmpw1 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol vcmpw after reset00000000 7 6 5 4 3 2 1 0 bit symbol vcmpw after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 vcmpw[15:0] r/w pwm setting of w-phase pwm pulse width of w-phase: 0x0000 to 0xffff
page 13-46 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.21veoutcr1(6-phase output control register) output control of u,v and w-phase of pmd is shown below. (the table shows only those combinations that are used in the ve.) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------wpwm after reset00000000 7 6 5 4 3 2 1 0 bit symbol vpwm upwm woc voc uoc after reset00000000 bit bit symbol type function 31-9 ? r read as "0". 8 wpwm r/w pwm of w-phase 0: on/off output 1: pwm output 7 vpwm r/w pwm of v-phase 0: on/off output 1: pwm output 6 upwm r/w pwm of u-phase 0: on/off output 1: pwm output 5-4 woc[1:0] r/w output control of w-phase 00: wo off, zo off 01: wo on, zo off 10: wo off, zo on 11: wo on, zo on (note) wo and zo are both on when =1. 3-2 voc[1:0] r/w output control of v-phase 00: vo off, yo off 01: vo on, yo off 10: vo off, yo on 11: vo on, yo on (note) vo and yo are both on when =1. 1-0 uoc[1:0] r/w output control of u-phase 00: uo off, xo off 01: uo on, xo off 10: uo off, xo on 11: uo on, xo on (note) uo and xo are both on when =1.
page 13-47 TMPM372FWUG 2013/4/15 13.3.4.22vetrgcrc1(synchronizing trigger correction value register) , pmd setting: output control of u-phase (uo,xo) setting output uo xo 0 00 off output off output 10 0 pwmu inverted out- put pwmu output 1 11 pwmu output pwmu inverted out- put , pmd setting: output control of v-phase (vo,yo) setting output vo yo 0 00 off output off output 10 0 pwmv inverted out- put pwmv output 1 11 pwmv output pwmv inverted out- put , pmd setting: outp ut control of w-phase (wo,zo) setting output wo zo 0 00 off output off output 10 0 pwmw inverted output pwmw output 1 11 pwmw output pwmw inverted output 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol trgcrc after reset00000000 7 6 5 4 3 2 1 0 bit symbol trgcrc after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 trgcrc[15:0] r/w used to correct the synchronizing trigger timing. the value to be set is: correction time[s] pwm counter clock frequency[s]
page 13-48 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.23vetrgcmp01/vetrgcmp11(trigger timing setting register) note 1: these registers are effective when one of the following pmd trigger modes is selected: count-down match, count-up match, count-up/-down match. note 2: these registers are ineffective when the pmd trigger output mode is set to trigger select output (pmd1trgmd=1). vetrgcmp01 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol vtrgcmp0 after reset00000000 7 6 5 4 3 2 1 0 bit symbol vtrgcmp0 after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 vtrgcmp0[15:0] r/w pmd setting: specifies the trigger timing for sampling adc in synchronization with pmd. 0x0000: prohibited 0x0001 to ( value -1): trigger timing value to 0xffff: prohibited vetrgcmp11 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol vtrgcmp1 after reset00000000 7 6 5 4 3 2 1 0 bit symbol vtrgcmp1 after reset00000000 bit bit symbol type function 31-16 ? r read as 0. 15-0 vtrgcmp1[15:0] r/w pmd setting: specifies the trigger timing for sampling adc in synchronization with pmd. 0x0000: prohibited 0x0001 to ( value -1): trigger timing value to 0xffff: prohibited
page 13-49 TMPM372FWUG 2013/4/15 13.3.4.24vetrgsel1(synchronizing trigger selection register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol----- vtrgsel after reset00000000 bit bit symbol type function 31-3 ? r read as 0. 2-0 vtrgsel[2:0] r/w pmd setting: specifies the synchronizing trigger number to be output at the timing specified in the . 0 to 5: output trigger number 6 to 7: prohibited note) these registers are effective when the pmd trigger output mode is set to trigger select output (pmd1trgmd= 1).
page 13-50 13. vector engine (ve) 13.3 list of registers TMPM372FWUG 2013/4/15 13.3.4.25veemgrs1(emg return control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------emgrs after reset00000000 bit bit symbol type function 31-1 ? r read as "0". 0 emgrs r/w pmd setting : emg return command for returning from the emg state 0: nop 1: emg return command
page 13-51 TMPM372FWUG 2013/4/15 13.4 description of operations 13.4.1 schedule management figure 13-4 shows a flowch art for motor control. the vector engine makes state transitions according to the schedule and mode settings which are programmed through the relevant registers. figure 13-4 example of motor control flow reset initial setting ve/pmd/adc enable ve change veactsch change veactsch change vemode change veactsch change vemode change veactsch change veactsch change vemode change veactsch change vemode change vemode change vemode 9?executed by the ve 9?software control stop positioning forced commutation speed control by current feedback brake emg return initial input
page 13-52 13. vector engine (ve) 13.4 description of operations TMPM372FWUG 2013/4/15 reset : microcontroller reset initial setting : initial setting by a user-created program stop : stop the motor. initial input : sample and store zero-current data when the motor is at stop positioning : determine the initial motor position. forced commutation : start the motor. for a specified period, the motor is rotated at a specified speed, not controlled by current feedback. speed control by current feedback : control motor rotation by current feedback. brake : deceleration control emg return : return from the emg state.
page 13-53 TMPM372FWUG 2013/4/15 13.4.1.1 schedule control the veactsch register is used to select the schedule to be executed. a schedule is comprised of an output schedule hand ling output-related tasks and an input schedule han- dling input-related tasks. table 13-1 shows the tasks that are executed in each schedule. the vemode register is used to enable or disabl e phase interpolation, control output operation, and enable or disable zero-current detect ion as appropriate for each step of the motor control flow (see table 13-2). note 1: each task is executed only when it is specified. note 2: phase interpolation. note 3: output off: note 4: task operation to be switched by zero-current detection. an output schedule begins executing by the vecp uruntrg command. when al l output-related tasks are completed, the vector engine enters a standby stat e and waits for a start trigger for input-related tasks. at this time, schedules of the other channel can be executed. an input schedule begins executing by a start trigge r. when all input-related tasks are completed, the vector engine generates an interrupt to the cpu and enters a halt state. however, if the schedule has its repeat count (vereptime) set to "2" or more, an inte rrupt is not generated until the schedule is executed the specified number of times. table 13-1 tasks to be executed in each schedule schedule selection veactsch output schedule input schedule current control sin/cos computation output coordinate axis conversion output phase conversion output control trigger generation input processing input phase conversion input coordinate axis conversion 0 : individual execu- tion (note1) (note1) (note1) (note1) (note1) (note1) (note1) (note1) (note1) 1 : schedule 1 ? (note2) ?? (note3) ? (note4) ? 4 : schedule 4 - (note2) ?? (note3) ? (note4) ? 9 : schedule 9 - - - - (note3) ? (note4) - - table 13-2 typical setting example register setting schedule selection veactsch task specification vetaskapp phase interpolation vemode output control vemode zero-current detec- tion vemode motor control flow stop 9 0 x 00 0 initial input 9 0 x 00 1 positioning 1 5 0 01 0 forced commutation 1 5 1 01 0 speed control by current feedback 1510 10 brake 4 6 0 01 0 emg return 9 0 x 11 0
page 13-54 13. vector engine (ve) 13.4 description of operations TMPM372FWUG 2013/4/15 figure 13-5 sche dule execution flow start command execute output schedule wait for start trigger execute input schedule repeated specified number of times? schedule end yes no start trigger
page 13-55 TMPM372FWUG 2013/4/15 13.4.1.2 start control enable the vector engine with the veen register. specify a schedule (veactsc h register), task to be executed (vetaskapp register) and re peat count (vereptime register). a schedule of the vector engine is comprised of an output schedule and an input schedule. typically, the vector engine executes an output schedule first, enters a standby state, and then starts executing an input schedule by a start trigger. ? an output schedule is started: 1. by the vecpuruntrg command. in this cas e, the task specified in the vetaskapp register is executed. 2. on a repeat start (when vereptime 2) after the corresponding input schedule is com- pleted. ? an input schedule is started: 1. by a start trigger (selected in the vetrgmode register) after the corresponding output schedule is completed. 2. by the vecpuruntrg command. in this cas e, the task specified in the vetaskapp register is executed. 13.4.2 summary of tasks table 13-3 gives a summary of tasks executed in output and input schedules. when each task is to be executed individually or speci fied as a startup task, use the task number shown in this table. table 13-3 list of tasks task task description task number output schedule current control controls dq currents 5 sin/cos computa- tion performs sine/cosine computation and- phase interpolation. 6 output coordinate axis conversion converts dq coordinates to coordinates. 7 output phase con- version converts 2-phase to 3-phase. 8 output control converts data to pmd setting format. switches pwm shift. 0 trigger generation generates synchronization trigger timing. 1 input schedule input processing captures ad conversion results and con- verts them into fixed-point format. 2 input phase conver- sion converts 3-phase to 2-phase. 3 input coordinate axis conversion converts coordinates to dq coordinates. 4
page 13-56 13. vector engine (ve) 13.4 description of operations TMPM372FWUG 2013/4/15 13.4.2.1 current control the current control unit is comprised of a pi control unit for d-axis and a pi control unit for q-axis, and calculates d-axis an d q-axis voltages. 1. pi control of d-axis current 2. pi control of q-axis current ? id = veidref1 ? : difference between current reference value and current feedback vdi1 = vecidki1 ? id + vdi1 : integral term computation vevd1 = vecidkp1 ? id + vdi1 : voltage calculation using proportional term register name function input veid1 d-axis current 32-bit fixed-point data (31 fractional bits) veidref1 eference value of d- axis current 16-bit fixed-point data (15 fractional bits) vecidkp1 proportional coeffi- cient 16-bit data vecidki1 integral coefficient 16-bit data output vevd1 d-axis voltage 32-bit fixed-point data (31 fractional bits) internal vdi1 integral term of d- axis voltage 64-bit fixed-point data (63 fractional bits) ? iq = veiqref1 ? : difference between current reference value and current feedback vqi1 = veciqki1 ? iq + vqi1 : integral term computation vevq1 = veciqkp1 ? iq + vqi1 : voltage calculation using proportional term register name function input veiq1 q-axis current 32-bit fixed-point data (31 fractional bits) veiqref1 reference value of q-axis current 16-bit fixed-point data (15 fractional bits) veciqkp1 proportional coeffi- cient 16-bit data veciqki1 integral coefficient 16-bit data output vevq1 q-axis voltage 32-bit fixed-point data (31 fractional bits) internal vqi1 integral term of q- axis voltage 64-bit fixed-point data (63 fractional bits)
page 13-57 TMPM372FWUG 2013/4/15 13.4.2.2 sin/cos computation the sin/cos computation unit is comprised of a phase interpolation unit and a sin/cos computation unit. phase interpolation calculates the rotation speed by integrating with the pwm period. it is executed only when phase interpolation is enabled. 1. phase interpolation 2. sin/cos computation vetheta1 = veomega1 vetpwm1 + vetheta1 : integration of rotation speed. only when phase interpolation is enabled. register name function input vetheta1 phase 16-bit fixed-point data (0.0 to1.0, 16 fractional bits) veomega1 rotation speed 16-bit fixed-point data (-1.0 to 1.0, 15 fractional bits) vetpwm1 pwm period rate 16-bit fixed-point data (0.0 to1.0, 16 fractional bits) vemode1 phase interpolation enable mode settings output vetheta1 phase 16-bit fixed-point data (0.0 to 1.0, 16 fractional bits) vesinm1 = vesin1 : saves previous value (for input processing). vecosm1 = vecos1 : saves previous value (for input processing). vesin1 = sin ( vetheta1 ) : sin/cos computation vecos1 = sin ( ( vetheta1 + 1/4 ) ) : sin/cos computation ? function input vetheta1 phase 16-bit fixed-point data (0.0 to 1.0, 16 fractional bits) output vesin1 sine value at 16-bit fixed-point data (-1.0 to 1.0, 15 fractional bits) vecos1 cosine value at vesinm1 previous sine value vecosm1 previous cosine value
page 13-58 13. vector engine (ve) 13.4 description of operations TMPM372FWUG 2013/4/15 13.4.2.3 output voltage conversion (coordinate axis conversion/phase conversion) output voltage conversion is comprised of dq-to- coordinate axis convers ion and 2-phase-to-3-phase conversion. the dq-to- coordinate axis conversion calculates v , v from vd, vq in sin and cos. the 2-phase-to-3-phase conversion performs segmentation by using v and v and performs space vector conversion to cal culate va, vb and vc. for the 2-phase-to-3-phase conversion, either 2-phase modulation or 3-phase modulation can be selected. 1. dq-to- coordinate conversion 2. 2-phase-to-3-phase conversi on (space vector conversion) a. segmentation vetmpreg3 = vecos1 vevd1 ? vesin1 vevq1 : calculates v . vetmpreg4 = vesin1 vevd1 + vecos1 vevq1 : calculates v . register name function input vevd1 d-axis voltage 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vevq1 q-axis voltage 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vesin1 sine value at 16-bit fixed-point data (-1.0 to 1.0, 15 fractional bits) vecos1 cosine value at 16-bit fixed-point data (-1.0 to 1.0, 15 fractional bits) output vetmpreg3 -axis voltage 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vetmpreg4 -axis voltage 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits)
page 13-59 TMPM372FWUG 2013/4/15 b. 3-phase voltage calculation (when 3-phase modulation is selected and =0 ) vesectorm1 = vesector1 : saves previous sector. if (v 0 & v 0) if (|v | |v | sqr( 3 ) if (|v | sqr( 3 ) |v |) =0 else =1 else =2 else if (v < 0 & v 0) if (|v | < |v | sqr( 3 )) =3 else if (|v | sqr( 3 ) < |v |) =4 else =5 else if (v < 0 & v < 0) if (|v | |v | sqr( 3 )) if (|v | sqr( 3 ) |v |) =6 else =7 else =8 else if (v 0 & v < 0) if (|v | < |v | sqr( 3 )) =9 else if (|v | sqr( 3 ) < |v |) =10 else =11 register name function input vetmpreg3 -axis voltage 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vetmpreg4 -axis voltage 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) output vesector1 sector 4-bit data vesectorm1 previous sector 4-bit data : calculates v1 period. : calculates v2 period. t3 = 1 ? t1 ? t2 : calculates v0+v7 period. vetmpreg0 = t1 + t2 + t3 2 : calculates va. vetmpreg1 = t2 + t3 2 : calculates vb. vetmpreg2 = t3 2 : calculates vc. t1 3 () vevdc () ? 3 () 2 ? v 12 ? v ? ? () = t2 3 () vevdc () ? v () =
page 13-60 13. vector engine (ve) 13.4 description of operations TMPM372FWUG 2013/4/15 register name function input vetmpreg3 -axis voltage 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vetmpreg4 -axis voltage 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vevdc1 supply voltage 16-bit fixed-point data (0.0 to 1.0, 15 fractional bits) vesector1 sector 4-bit data vefmode1 modulation mode mode settings output vetmpreg0 a-phase voltage 32-bit fixed-point data (0.0 to 1.0, 31 fractional bits) vetmpreg1 b-phase voltage 32-bit fixed-point data (0.0 to 1.0, 31 fractional bits) vetmpreg2 c-phase voltage 32-bit fixed-point data (0.0 to 1.0, 31 fractional bits)
page 13-61 TMPM372FWUG 2013/4/15 13.4.2.4 output control the output control unit converts 3-phase voltage values into pwm setting format (vecmpu1, vecmpv1 and vecmpw1 ), and sets the veout cr1 register to cont rol output operation. when 1-shunt current detection and 2-phase modulation are se lected and pwm is enabled, if the rota- tion speed is slower than the pwm shift switching re ference value, output is switched to shift pwm out- put. register name function input vetmpreg0 a-phase voltage 32-bit fixed-point data (0.0 to 1.0, 31 fractional bits) vetmpreg1 b-phase voltage 32-bit fixed-point data (0.0 to 1.0, 31 fractional bits) vetmpreg2 c-phase voltage 32-bit fixed-point data (0.0 to 1.0, 31 fractional bits) vemdprd1 pwm period 16-bit data (pmd pwm period ) vesector1 sector 4-bit data veomega1 rotation speed 16-bit fixed-point data (-1.0 to 1.0, 15 fractional bits) vefpwmchg1 pwm shift switching reference 16-bit fixed-point data (-1.0 to 1.0, 15 fractional bits) vemode1 output control operation mode settings vefmode1 pmd channel/ shift enable/ modulation mode/ detection mode/ mode settings output vecmpu1 pmd u-phase pmw setting 16- bit data (0 to mdprd value) vecmpv1 pmd v-phase pwm setting 16- bit data (0 to mdprd value) vecmpw1 pmd w-phase pwm setting 16- bit data (0 to mdprd value) veoutcr1 pmd output control setting 9-bit setting veemgrs1 pmd emg return 1-bit setting vemctlf1 shift switching flag status
page 13-62 13. vector engine (ve) 13.4 description of operations TMPM372FWUG 2013/4/15 13.4.2.5 trigger generation the trigger generation unit calculates the trigge r timing from the pwm setting values (vecmpu1, vecmpv1x and vecmpw1x) as appropriate to the current detection method, and sets the vetrgcmp01 and vetr gcmp11 registers. register name function input vecmpu1 pmd u-phase pwm setting 16-bit data (0 to mdprd value) vecmpv1 pmd v-phase pwm setting 16-bit data (0 to mdprd value) vecmpw1 pmd w-phase pwm setting 16-bit data (0 to mdprd value) vemdprd1 pwm period setting 16-bit data (pmd pwm period) vetadc ad conversion time 16-bit data (0 to mdprd value) vetrgcrc1 trigger correction value 16-bit data (0 to mdprd value) vesector1 sector 4-bit data vemode1 output control operation mode settings vefmode1 pmd channel/ shift enable/ modulation mode/ detection mode mode settings vemctlf1 shift switching flag status output vetrgcmp0 pmd trigger 0 timing 16-bit data (0 to mdprd value) vetrgcmp1 pmd trigger 1 timing 16-bit data (0 to mdprd value) vetrgsel1 pmd trigger selection 3-bit data
page 13-63 TMPM372FWUG 2013/4/15 13.4.2.6 input processing the input processing unit saves segmented 3-phase current conversion results, and converts the current and voltage conversion results into fixed-point data. it saves zero-current conversion results in the initial input processing. register name function veadreg0b adc unit b conversion result 0 16-bit data (the upper 12 bits are used.) veadreg1b adc unit b conversion result 1 veadreg2b adc unit b conversion result 2 input veadreg3b adc unit b conversion result 3 vephnum0b adreg0b detected phase infor- mation 2-bit data vephnum1b adreg1b detected phase infor- mation vephnum2b adreg2b detected phase infor- mation vephnum3b adreg3b detected phase infor- mation vesectorm1 sector information 4-bit data vemode1 zero-current detection mode settings vefmode1 pmd channel / current detection mode / adc unit /shift enable mode settings vemctlf1 shift switching flag status output vevdc1 supply voltage 16-bit fixed-point data (0.0 to 1.0, 15 fractional bits) vetmpreg0 a-phase current 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vetmpreg1 b-phase current vetmpreg2 c-phase current internal veiao1 a-phase zero-current conversion result 16-bit data (the upper 12 bits are used.) veibo1 b-phase zero-current conversion result veico1 c-phase zero-current conversion result veiaadc1 a-phase current conversion result 16-bit data (the upper 12 bits are used.) veibadc1 b-phase current conversion result veicadc1 c-phase current conversion result
page 13-64 13. vector engine (ve) 13.4 description of operations TMPM372FWUG 2013/4/15 13.4.2.7 input current conversion (phas e conversion/coordinate axis conversion) input current conversion is comprised of 3-phase-to-2-phase conversion and -to-dq coordinate axis conversion. the 3-phase-to-2-phase co nversion calculates i and i from la, lb and lc. the -to-dq coordinate axis conversion calculate s ld and lq from id and iq from i , i , vesinm and vecosm. 1. 3-phase-to-2-phase conversion 2. -to-dq coordinate conversion vetmpreg3 = vetmpreg0 : calculates i . vetmpreg4 = 1 sqr( 3 ) vetmpreg1 ? 1 sqr( 3 ) vetmpreg2 : calculates i register name function input vetmpreg0 a-phase current 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vetmpreg1 b-phase current 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vetmpreg2 c-phase current 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) output vetmpreg3 -axis current 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vetmpreg4 -axis current 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) veid1 = vecosm1 vetmpreg3 + vesinm1 vetmpreg4 : calculates id. veiq1 = ? vesinm1 vetmpreg3 + vecosm1 vetmpreg4 : calculates iq. register name function input vetmpreg3 -axis current 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) vetmpreg4 -axis current vesinm1 sine value at 16-bit fixed-point data (-1.0 to 1.0, 15 fractional bits) vecosm1 cosine value at output veid1 d-axis current 32-bit fixed-point data (-1.0 to 1.0, 31 fractional bits) veiq1 q-axis current
page 13-65 TMPM372FWUG 2013/4/15 13.5 combinations of ve ch annel, adc unit and pmd channel the vector engine calculates the stored value in ad conversion result register 0 to 2 (adbreg0 to 2) as a current data and calculates the sotred value in ad conversion re sult register 3 (adbreg3) as a voltage data. therefore, please specify it with proper setting, referring to table 13-4. note 1: specifying the phase information to the register is neces sary. however the ad conversion result of its register is not used for calculation. vector engine adc unit b current ditection adreg0 adreg1 adreg2 adreg3 0x current data 1 current data 2 note 1 vdc data 1x current data 1 current data 2 vdc data
page 13-66 13. vector engine (ve) 13.5 combinations of ve channel, adc unit and pmd chan- nel TMPM372FWUG 2013/4/15
page 14-1 TMPM372FWUG 2013/4/15 14. encoder input circuit (enc) 14.1 outline the encoder input circuit supports four operation modes including encoder mode, sensor mode (two types) and timer mode. and the functions are as follows: ? supports incremental encoders and hall sensor ics. (signals of hall sensor ic can be input directly) ? 24-bit general-purpose timer mode ? multiply-by-4 (multiply-by-6) circuit ? rotational direction detection circuit ? 24-bit counter ? comparator enable/disable ? interrupt request output:1 ? digital noise filters for input signals 14.2 differences between channels the TMPM372FWUG has a one-channel incremental encoder interface (enc 1), which can obtain the absolute position of the motor, based on input signals from the incremental encoder. these channels operate identical except the differences in below. 14.3 block diagram figure 14-1 block diagram of encoder input circuit table 14-1 differences between channels channel input pin encoder input interrupt a-phase b-phase z-phase channel1 pf2 / enca1 pf3 / encb1 pf4 / encz1 intenc1 noise filter noise filter noise filter enca encb encz input selecter decorder timer counter interrupt reqest control interrupt request intenc 1 1 1 1
page 14-2 14. encoder input circuit (enc) 14.4 registers TMPM372FWUG 2013/4/15 14.4 registers 14.4.1 list of registers the following is control registers a nd addresses of encoder input circuit. channel1 0x4001_0500 register name address(base+) encoder input control register en1tncr 0x0000 encoder counter reload register en1reload 0x0004 encoder compare register en1int 0x0008 encoder counter en1cnt 0x000c
page 14-3 TMPM372FWUG 2013/4/15 14.4.2 en1tncr(encoder input control register) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol----- mode p3en after reset00000000 15 14 13 12 11 10 9 8 bit symbol cmp reverr ud zdet sftcap enclr zesel cmpen after reset00000000 7 6 5 4 3 2 1 0 bit symbol zen enrun nr inten endev after reset00000000
page 14-4 14. encoder input circuit (enc) 14.4 registers TMPM372FWUG 2013/4/15 bit bit symbol type function 31-19 ? r read as "0". 18-17 mode[1:0] r/w encoder input mode setting 00:encoder mode 01:sensor mode (event count)) 10:sensor mode (timer count)) 11:timer mode 16 p3en r/w 2-phase / 3-phase input selection (sensor mode) (note 1) 0:2-phase input 1:3-phase input sets the number of input signals. 15 cmp r compare flag 0:- 1:compare (clear by rd) if comparing is executed, is set to "1". flag is cleared by reading the values. when = "0 " is set, always "0" is se t. writing to this bit is no effect. 14 reverr r reverse error flag (sensor mode (at timer count)) (note 2) 0:- 1:error (clear by rd) in sensor mode (at timer count), when a re verse error occurs, is set to "1". flag is cleared by reading the values. when = "0" is set, always "0" is set. writing to this bit is no effect. in the encoder mode, sensor mode (event c ount) and timer mode, this bit has no meaning. 13 ud r rotation direction 0:ccw (a-phase has the 90-degree phase lead to b-phase using incremental encoder) 1:cw (a-phase has the 90-degree phase lag to b-phase using incremental encoder) is set to "0", when = "0". 12 zdet r z-detected 0:not detected 1:z-phase detected is set to 1 on the first edge of z input sig nal (encz) after is written from 0 to 1. this occurs on a rising edge of the signal z during cw rota tion or on a falling edge of z during ccw rotation. is set to "0" when = "0". has no influence on the value of . is set to "0" in the sensor ev ent count and the sensor timer count modes. in the sensor mode (event count) and sensor mode (timer count), this bit is always set to "0". 11 sftcap w executes software capture (timer mode/sensor mode (at timer count)) 0:- 1:software capture if is set to 1, the value of the encoder counter is captured into the encnt register. writing "0" to has no effect. reading always returns to "0". in encoder and sensor event count modes, ha s no effect; writing "1" to this bit is ignored. 10 enclr w encoder pulse counter clear 0:- 1:clear writing a 1 to clears the encoder counter to "0". once cleared, the encoder counter restarts counting from 0. writing "0" to has no effect. reading always returns to "0". 9 zesel r/w edge selection of encz (timer mode) 0:rising edge 1:falling edge in timer mode, this bit selects inputs edge of encz used as external trigger. in the other mode, this bit has no meaning. 8 cmpen r/w compare enable 0:disable 1:enable when "1" is set to , this bit compares counter values of encoder counter with register value of enint. when "0" is set to , this compare is disabled.
page 14-5 TMPM372FWUG 2013/4/15 note 1: in the encoder mode or timer mode, must be set to "0". note 2: if changing the mode, first read the flag to clear. the operation mode has eight modes specified with, and . the operation mode set tings are as follows: 7 zen r/w z-phase enable (encoder mode/timer mode) 0:disable 1:enable in the other mode, this bit has no meaning clear setting of encoder counter using encz input when = "1" is set, if a rising edge of encz is detected dur- ing rotating clockwise, the encoder counter is cleared to "0". if a falling edge of encz is detected during rotating counter- clock- wise, the encoder counter is cleared to "0". if the edges of enclk (multiply by 4 clock derived from the decoded a and b signals) and the edge of encz coincide, the encoder counter is cleared to "0" without incrementing or decre- menting (i.e., the clear takes precedence). sets encz input to use as an external trigger. when = 1, the value of the encoder counter is captured into the en0int register and cleared to "0" on the edge of encz selected by . 6 enrun r/w encoder operation enable 0:disable 1:enable setting to 1 and clearing to "0" enables the encoder operation. clearing to "0" disables the encoder operation. there are counters and flags that are cleared and not cleared when bit is cleared to "0". 5-4 nr[1:0] r/w noise filter 00:no filtering 01:filters out pulses narrower than 31/fsys as noise (387.5ns@80mhz) 10:filters out pulses narrower than 63/fsys as noise (787.5ns@80mhz) 11:filters out pulses narrower than 127/fsys as noise (1587ns@80mhz) the digital noise filters remove pulses narrower than the width selected by . 3 inten r/w encoder interrupt enable 0:disable 1:enable enables or disables the enc interrupt. setting to "1" enables interrupt generation. setting to "0" disables interrupt generation. 2-0 endev[2:0] r/w encoder pulse division factor 000:divided by 1 100:divided by 16 001:divided by 2 101:divided by 32 010:divided by 4 110:divided by 64 011:divided by 8 111:divided by 128 sets encoder pulse division factor the frequency of the encoder pulse is divided by the factor specified by . the divided signal determines the interval of the event interrupt. bit bit symbol type function
page 14-6 14. encoder input circuit (enc) 14.4 registers TMPM372FWUG 2013/4/15 the following is the status of and corresponding signals. input pin mode 00 0 0 a, b encoder mode 1 a,b,z encoder mode (use of z) 01 0 0 u,v sensor mode (event count, 2-phase input) 1 u,v,w sensor mode (event count, 3-phase input) 10 0 0 u,v sensor mode (timer count, 2-phase input) 1 u,v,w sensor mode (timer count, 3-phase input) 11 0 0 - timer mode 1 z timer mode (use of z) counter/flag = 0 (after reset) = 1 (operating) = 0 (stopping) = 0 object flag/counter clear procedure encoder counter 0x000000 count operation maintains a value when stopping software clear ( = 1 wr) noise filter counter 0y0000000 count-up operation count-up operation (always filtering) only reset encoder pulse division counter 0x00 count-down operation stopped and cleared clear when = "0" compare flag 0 "1" is set when com- paring clear when read. cleared clear when = "0" reverse error flag 0 "1" is set when error occurs. clear when read. cleared clear when = "0" z detection flag 0 "1" is set when z is detected. cleared clear when = "0" rotation direction bit 0 "0"/"1" is set depend- ing on the direction cleared clear when = "0"
page 14-7 TMPM372FWUG 2013/4/15 14.4.3 en1reload(encoder counter reload register) the reload register is only used in encoder mode. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol reload after reset00000000 7 6 5 4 3 2 1 0 bit symbol reload after reset00000000 bit bit symbol type function 31-16 ? r read as "0". 15-0 reload[15:0] r/w sets the encoder counter period (after multiplied by 4 or six) 0x0000 to 0xffff z-phase is used : sets the num ber of count pulses for one rotation z-phase is not used : sets the number of count pulses minus one for one rotation defines the encoder counter period multiplied by 4. if the encoder counter is configur ed as an up-counter, it increments up to the value programmed in and then wraps around to "0" on the next enclk. if the encoder counter is configured as a down-counter, it decrements to "0" and then is reloaded with the value of on the next en- clk.
page 14-8 14. encoder input circuit (enc) 14.4 registers TMPM372FWUG 2013/4/15 14.4.4 en1int(encoder compare register) is used only in sensor mode (timer count) and timer mode. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol int after reset00000000 15 14 13 12 11 10 9 8 bit symbol int after reset00000000 7 6 5 4 3 2 1 0 bit symbol int after reset00000000 bit bit symbol type function 31-24 ? r read as "0". 23-0 int[23:0] r/w counter compare value setting encoder mode: interrupt c ondition of the encoder pul se position. 0x0000 to 0xffff while = "1" is set, if an encoder counter value matches a value of , is set to "1". if = "1"is set, an interrupt request (intenc0) occurs. however if = "1" is set, an interrupt request does not occur until = "1". sensor mode: (event count) interrupt condition of the encod er pulse position. 0x0000 to 0xffff while = "1" is set, if an encoder counter value matches a value of , is set to "1". if = "1"is set, an interrupt request (intenc0) occurs. this bit has no effect on a value of . sensor mode: (timer count) interrupt condition of abnormal pulse detection time 0x000000 to 0xffffff when = "1" is set, an internal counter value matches a value of , abnormal pulse detection time error is determined and is set to "1". if = "1" is set, an interrupt request (intenc0) occurs. this bit has no effect on a value of . timer mode interrupt condition of timer compare 0x000000 to 0xffffff when = "1" is set, an internal counter value matches a value of , abnormal pulse detection time error is determined and is set to "1". if = "1" is set, an interrupt request (intenc0) occurs. this bit has no effect on a value of .
page 14-9 TMPM372FWUG 2013/4/15 14.4.5 encnt (e ncoder counter) 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol cnt after reset00000000 15 14 13 12 11 10 9 8 bit symbol cnt after reset00000000 7 6 5 4 3 2 1 0 bit symbol cnt after reset00000000 bit bit symbol type function 31-24 ? r read as "0". 23-0 cnt[23:0] r/w encoder counter/capture value encoder mode: counter value of encoder pulse 0x0000 to 0xffff the value of encoder count can be read. in encoder mode, the encoder counter counts up or down on each encoder pulse (enclk). during cw rotation, encoder counter counts up; when it has reached to the value of , it wraps around to "0" on the next enclk. during ccw rotation, encoder counter counts down; when it has reached to "0", it is reloaded with the value of on the next enclk. sensor mode: (event count) counter value of encoder pulse 0x0000 to 0xffff the value of encoder count can be read. in sensor event count mode, the encoder counter counts up or down on each encoder pulse (enclk). during cw rotation, encoder counter counts up; when it has reached to "0xffff", it wraps around to "0" on the next enclk. during ccw rotation, encoder counter counts down; when it has reached to "0", it wraps around to "0xffff" on the next enclk. sensor mode: (timer count) pulse detection time or captured value by software 0x000000 to 0xffffff the value of encoder counter can be read. in sensor mode, the value of encoder counter can be read and captured by software on each encoder pulse (enclk) by writing "1" to . the captured value is cleared to "0" by system reset. it can also be cleared by clearing the counter by setting to 1 and then setting to 1. in sensor timer count mode, the encoder counter is configured as a free-run- ning counter that counts up with fsys. the encoder counter is cleared to "0" when the encoder pulse (enclk) is detected. when it has reached to "0xffffff", it wraps around to "0" automatically. timer mode capture value of internal counter or captured value by software 0x000000 to 0xffffff the value of encoder counter can be read and captured by software by writing "1" to .when = "1", the value of the encoder counter is also captured into on the z edge selected by . the captured value is cleared to "0" by reset. it can also be cleared by clearing t he counter by setting to 1 and then setting to 1. in timer mode, the encoder counter is configured as a free-running counter that counts up with fsys. when it has reached to "0xffffff", it wraps around to "0" automatically.
page 14-10 14. encoder input circuit (enc) 14.4 registers TMPM372FWUG 2013/4/15 is used only in the sensor mode (timer counting) or timer mode. in the encoder mode or sen- sor mode (event counting), always reads as "0".
page 14-11 TMPM372FWUG 2013/4/15 14.5 operational description 14.5.1 encoder mode the high-speed position sensor determines the phas e input from the ab encoder and the abz encoder. ? event detection (rotation pulse) interrupt generation ? event count match detection interrupt generation (measures the amoun t of transferring) ? detects rotati on direction ? up/down-count (changeable in operation) ? settable counter cycle 14.5.2 sensor mode the low-speed position sensor determ ines (zero-cross determination) th e phase input from uv hall sensor and uvw hall sensor. there are two kinds of sensor modes such as event count mode and timer count mode (counts with fsys). 14.5.2.1 event count mode ? event detection (rotation pulse) interrupt generation ? event count match interrupt occurs (measur ing the amount of transfer) ? rotation direction detection 14.5.2.2 timer count mode ? event detection (rotation pulse) interrupt generation ? timer count ? rotation direction detection ? capture function event capture (measures event intervals) interrupt generation software capture ? abnormal detection time error (timer compare) match detection interrupt generation ? reverse detection error error flag caused by changing rotation direction 14.5.3 timer mode this mode can be used as a general-purpose 24-bit timer. ? 24-bit up counter ? counter clear control (software clear, timer clear, exte rnal trigger and free-run count) ? compare function match detection interrupt generation ? capture function external trigger capture interrupt generation software capture
page 14-12 14. encoder input circuit (enc) 14.6 function TMPM372FWUG 2013/4/15 14.6 function 14.6.1 mode operation outline 14.6.1.1 encoder mode 1. if = 1 ( = 0x0380 , = 0x0002) 2. if = 0 ( = 0x0380 , = 0x0002) ? the incremental encoder inputs of the mcu should be connected to the a, b and z channels. the encoder counter counts pulses of enclk, whic h is multiplied by 4 clock derived from the decoded a and b quadrature signals. ? during cw rotation (i.e., a has the 90-degree phase lead to b), the encoder counter counts up; when it has reached to the value of , it wraps around to "0" on the next enclk. ? during ccw rotation (i.e., a has the 90-degree phase lag to b), the encoder counter counts down; when it has reached to "0x0000", it is reloaded with the value of on the next enclk. ? additionally, when = "1", the encoder counte r is cleared to "0" on the rising edge of z during cw rotation and on the falling edge of z during ccw rotation (at the internal z_detected timing). if the enclk edge matches z edge, the encoder counter is cleared to "0" without incre- menting or decrementing. encorder pulse enxclk encorder input a encorder input b fsys interrupt request intenxc0 encorder counter 110 111 112 37d 0 380 37f 01 0 encorder input z internal z phase detection signal z phase detecting dir count clear timpls(divided by 2) cwfktgevkqp 123 0 380 37e ccw direction rotation direction 110 111 112 37e 37d 37c 01 0 cw direction 12 0 380 37f ccw direction 113 encorder pulse enxclk encorder input a encorder input b fsys interrupt request intenxc0 encorder counter encorder input z internal z phase detection signal z phase detecting dir count clear timpls(divided by 2) rotation direction
page 14-13 TMPM372FWUG 2013/4/15 ? when is set to 1, the en coder counter is cleared to "0". ? is set to 1 during cw rotation and cleared to "0" during ccw rotation. ? timpls, which is derived by dividing enclk by a programmed factor, can be driven out exter- nally. ? if is set to 1, an interrupt is gene rated when the value of the encoder counter has reached to the value of . when = "1", however, an interrupt does not occur while = "0". ? when and are set to "0", is cleared to "0". 14.6.1.2 sensor mode (event count) 1. if = 1 ( = 0x0002) 2. if = 0 ( = 0x0002) ? the hall sensor inputs of the mcu should be co nnected to the u, v and w channels. the encoder counter counts the pulses of enclk, which is either multiplied by 4 clock (when = "0") derived from the decoded u and v signals or multiplied by 6 clock (when = "1") derived from the decoded u, v and w signals. ? during cw rotation (i.e., u channel has the 90-de gree phase lead to v channel; v channel has the 90-degree phase lead to w channel), the encode r counter counts up; when it has reached to "0xffff", it wraps around to "0" on the next enclk. ? during ccw rotation (i.e., u channel has the 90-d egree phase lag to v channel; v channel has the 90-degree phase lag to w), the encoder counter counts down; when it has reached to "0x0000", it wraps around to "0xffff" on the next enclk. ? when is set to 1, the internal counter is cleared to "0". ? is set to 1 during cw rotation and cleared to "0" during ccw rotation. fsys fffc fffd ffff dir cw direction 123 0 ccw direction fffe fffa ffff 1 20 fffe fffd fffc fffb encorder pulse enxclk encorder input u encorder input v interrupt request intenxc0 encorder counter encorder input w count clear timpls(divide by 2) rotation direction fffc fffd ffff cw direction 123 0 ccw direction fffe fffa ffff 1 20 fffe fffd fffc fffb fsys dir encorder pulse enxclk encorder input u encorder input v interrupt request intenxc0 encorder counter encorder input w count clear timpls(divide by 2) rotation direction
page 14-14 14. encoder input circuit (enc) 14.6 function TMPM372FWUG 2013/4/15 ? timpls, which is derived by dividing enclk by a programmed factor, can be driven out exter- nally. ? if is set to 1, an interrupt is genera ted when the value of th e internal counter has reached to the value of . ? when and are set to "0", is cleared to "0". 14.6.1.3 sensor mode (timer count) 1. if = 1 ( = 0x0002) 2. if = 0 ( = 0x0002) ? in sensor timer count mode, the hall sensor inputs of the mcu should be connected to the u, v and w channels. the encoder counter measures th e interval between two contiguous pulses of enclk, which is either multiplied by 4 clock (when = "0") derived from the decoded u and v signals or multiplied by 6 clock (when = "1") derived from the decoded u, v and w signals. ? the encoder counter always counts up; it is cleared to "0" on enclk. when the encoder counter has reached to "0xffffff", it wraps around to "0". ? when is set to 1, the en coder counter is cleared to "0". ? enclk captures the value of the encoder counter into the en0cnt register. the captured counter value can be read out of en0cnt. ? setting the software capture bit, , to 1 causes the value of the encoder counter to be captured into the encnt register. this capture op eration can be performe d at any time. the cap- tured counter value can be read out of encnt. interrupt reqest intenxc0 dir cw direction ccw direction 23 1 0 12 3 1 0231 023 ccpture register 0(ini) 3 23 1 0202 1302 130 3 32 2 1302 1 reserse error reverr fsys encorder pulse enxclk encorder input u encorder input v encorder counter encorder input w timpls (divide by 2) rotation direction ccw direction 23 1 0 1231 0231 023 0(ini) 3 23 1 0202 1302 130 3 32 2 1302 1 interrupt reqest intenxc0 dir capture register reserse error reverr fsys encorder pulse enxclk encorder input u encorder input v encorder counter encorder input w timpls (divide by 2) rotation direction cw direction
page 14-15 TMPM372FWUG 2013/4/15 ? is set to 1 during cw rotation and cleared to "0" during ccw rotation. ? if is set to 1, an interrupt is gene rated when the value of the encoder counter has reached to the value of . ? when is set to "0", is cleared to "0". ? is set to 1 when the rotation direction has changed. this bit is cleared to "0" on a read. ? the value of the encnt register (the captured value) is retained, regardless of the value of . the encnt register is only cleared by a reset. 14.6.1.4 timer mode 1. if = 1 ( = 0x0006) 2. if = 0 ( = 0x0006) ? when = "1", the z input pin is used as an external trigger. when = "0", no exter- nal input is used to trigger the timer. ccw direction dir count clear timpls (divided by 2) cw direction z phase edge selection interrupt request intenxc0 capture register 0(ini) b b 41 31 32 3433 35 36 3837 39 40 041 1 2 4 3568 7 34 6 5 27 8 a 9b02 134 encorder counter compare interrupt compare interrupt capture interrupt capture interrupt encorder pulse enxclk encorder input a encorder input b fsys encorder input z internal z phase detection signal rotation direction ccw direction cw direction 0(ini) a a 31 32 3433 35 36 0 1 34 6 5 27 8 a 9bce df10 compare interrupt compare interrupt 34 6 5 27 8 a 9bcd 5qhvecrvwtg dir count clear timpls (divided by 2) z phase edge selection interrupt request intenxc0 capture register encorder counter encorder pulse enxclk encorder input a encorder input b fsys encorder input z internal z phase detection signal rotation direction
page 14-16 14. encoder input circuit (enc) 14.6 function TMPM372FWUG 2013/4/15 ? the encoder counter always counts up. if = "1 ", the counter is cleared to "0" on the rising edge of z when is set to "0" and a fal ling edge when is set to "1". when the encoder counter has reached to "0 xffffff", it wraps around to "0". ? when is set to 1, the en coder counter is cleared to "0". ? z-detected causes the value of the encoder counte r to be captured into the encnt register. the captured counter va lue can be read out of encnt. ? setting the software capture bit, , to 1 causes the value of the encoder counter to be captured into the encnt register. this capture op eration can be performe d at any time. the cap- tured counter value can be read out of encnt. ? is set to 1 during cw rotation and cleared to "0" during ccw rotation. ? if is set to 1, an interrupt is gene rated when the value of the encoder counter has reached to the value of . ? when is set to "0", is cleared to "0". ? the value of the encnt register (the captured value) is retained, regardless of the value of . the encnt register is only cleared by a reset.
page 14-17 TMPM372FWUG 2013/4/15 14.6.2 counter and interrupt gener ate operation when = 1 14.6.2.1 encoder mode 14.6.2.2 sensor mode (event count) 14.6.2.3 sensor mode (timer count) intenxc0(compare) 0 1 2 3 14c14d14e 14f 150 151 152 fffd fffe ffff 012 enxreload =0xffff enxint=0xffff (compsre register) 0 1 2 3 14c14d14e 14f 150 151 0 counter cleared by matching with counter cleared by matching with 1 intenxc0(compare) encorder counter encorder counter enxreload =0x0151 enxint=0x0150 (compare register) encorder pulse enxclk encorder input a encorder input b fsys nnnnnnnnnnnnnn nnnn nn nnn nnn encorder pulse enxclk encorder input u encorder input v fsys intenxc0(compare) encorder counter 0 1 2 3 14c14d14e 14f 150 151 152 fffd fffe ffff 012 enxint=0x0150 (compare register) the number of rotation pulse clears counter when counter is overflow nnnn nn nnn 0123 nnn 14c14d14e 14f 150 151 152 0123 nnn nnnnnnnnnnnnn 9e9f012345 nnn ff_ fffd ff_ fffe ff_ ffff 012 nnn 0123 nnn 14c14d14e 14f 150 151 152 nnn ff_ fffd ff_ fffe ff_ ffff 012 nnn hu[u 'peqtfgtrwnugenxclk u / v / w enxint=0x0150 (compare register undetection time error time without undetection error enxint=0xffff (compare register) undetection time error time enxint=0x0150 (compare register) undetection time error time with undetection error intenxc0 (compare) encorder counter intenxc0 (compare) encorder counter intenxc0 (caprture) encorder counter intenxc0 (compare) clears counter by rotation pulse clears counter when counter is overflow clears counter when counter is overflow
page 14-18 14. encoder input circuit (enc) 14.6 function TMPM372FWUG 2013/4/15 14.6.2.4 timer mode intenxc0(compare) encorder counter 0 1 2 3 14f 150 151 152 ff_ fffd ff_ fffe ff_ ffff 012 enxint=0xffff (compare register) 0123 clears counter by matching clears counter by matching 14f 150 1 2 intenxc0(compare) encorder counter enxint=0x0150 (compare register) fsys 0 nnnn nnn nnn nnnnnnnnnnnn nnn
page 14-19 TMPM372FWUG 2013/4/15 14.6.3 counter and interrupt gener ate operation when = 0 14.6.3.1 encoder mode ="000" 14.6.3.2 sensor mode (event count) ="000" 14.6.3.3 sensor mode (timer count) intenxc0(event) encorder counter 0 1 2 3 14c14d14e 14f 150 151 152 fffd fffe ffff 012 enxreload =0xffff enxint=0xffff (compare register) 0 1 2 3 14c14d14e 14f 150 151 0 clears couter by matching with clears couter by matching with 1 intenxc0(event) encorder counter enxreload =0x0151 enxint=0x0150 (compare register) encorder pulse enxclk encorder input a encorder input b fsys nnnnnnnnnn nnnn nn nnn nnn encorder pulse enxclk encorder input u encorder input v fsys intenxc0(compare) encorder counter 0 1 2 3 14c14d14e 14f 150 151 152 ff_ fffd ff_ fffe ff_ ffff 012 enxint=0x0150 (compare register) the number of rotation pulse clears counter when counter is overflow nnn nn nn intenxc0 (compare) encorder counter enxint=0xffff (compare register) undetection time error time 0123 intenxc0 (compare) encorder counter enxint=0x0150 (compare register) undetection time error time nnn 14c14d14e 14f 150 151 152 clears counter by rotation pulse 0123 intenxc0 (caprture) encorder counter enxint=0x0150 (compare register undetection time error time nnn nnnnnnnnnnnnn 9e 9f 0 1 2 3 4 5 clears counter when counter is overflow clears counter when counter is overflow intenxc0 (compare) nnn ff_ fffd ff_ fffe ff_ ffff 012 nnn 0123 nnn 14c14d14e 14f 150 151 152 nnn ff_ fffd ff_ fffe ff_ ffff 012 nnn fsys encorder pulse enxclk u / v / w with undetection error without undetection error
page 14-20 14. encoder input circuit (enc) 14.6 function TMPM372FWUG 2013/4/15 14.6.3.4 timer mode intenxc0(compare) encorder counter 0 1 2 3 14f 150 151 152 fffd fffe ffff 012 enxint=0xffff (compare register) 0123 clears counter by matching clears counter by matching 14f 150 1 2 intenxc0(compare) encorder counter enxint=0x0150 (compare register) fsys 0 nnnnnn nnn nnn nnnnnnnnnn nnn
page 14-21 TMPM372FWUG 2013/4/15 14.6.4 encoder rotation direction this circuit determines a phase either a-, b- or z-phase. it is used as 2-phase input (a,b) and 3-phase input (a,b,z) in common. when 3-phase input is used, set = "1". 2-phase input 3-phase input cw direction ccw direction 01 a b 00 11 010 1 00 01 a b 01 10 001 1 01 01 1 00 0 100 0 11110 z 01 b a 00 11 010 1 00 a b 001 1 01 010 1 10 01 1 00 0 100 0 11110 z
page 14-22 14. encoder input circuit (enc) 14.6 function TMPM372FWUG 2013/4/15 14.6.5 counter circuit the counter circuit has a 24-bit up/down counter. 14.6.5.1 operation description depending on the operation modes, counting, cl earing and reloading operation are controlled as described in table 14-2. note: the counter value is not cleared by writing "0" to . if = "1" is set again, the counter restarts from the counter value which has stopped. if clear the counter value, write "1" to to execute software clear. table 14-2 counter control mode input pin count opera- tion counter clear condi- tion counter reload condition operational range of counter (reload value) encoder mode 00 0 0 a,b encoder pulse (enclk) up [1] = 1 wr [2] matches with - 0x0000 to reload> down [1] = 1 wr [1] matches with 0x0000 1a , b , z up [1] = 1 wr [2] matches with [3] z-trigger - down [1] = 1 wr [1] matches with 0x0000 sensor mode (event count) 01 0 0u,v up [1] = 1 wr [2] matches with 0xffff - 0x0000 to 0xffff down [1] = 1 wr [1] matches with 0x0000 1 u,v,w up [1] = 1 wr [2] matches with 0xffff - down [1] = 1 wr [1] matches with 0x0000 sensor mode (timer count) 10 0 0u,v fsys up [1] = 1 wr [2] matches with 0xffffff - 0x000000 to 0xffffff 1 u,v,w up [3] encoder pulse (enclk) - timer mode 11 0 -u p [1] = 1 wr [2] matches with 0xffffff [3] matches with - 0x000000 to 0xffffff 1zu p [1] = 1 wr [2] matches with 0xffffff [3] matches with [4] z-trigger -
page 14-23 TMPM372FWUG 2013/4/15 14.6.6 interrupt the interrupt consists of four interrupts including event (divide pulse and captu re), abnormal detecting time, timer compare an d capture interrupts. 14.6.6.1 operational description when = "1" is set, interrupts occurs by counter value and encoder pulses. interrupt factor setting consists of six kinds set ting with operation modes and the setting of and .table 14-3 shows interrupt factors. in sensor timer count mode and timer mode, the valu e of the encoder counter can be captured into the encnt register. the captured counter value can be read out of the encnt register. in sensor timer count mode, the value of the encoder counter is captured into the encnt register upon occurrence of an event (encoder pulse). the counter value can also be captured by writing a 1 to by software. in timer mode, the counter value can be captured by writing a 1 to by software. if is set to 1, the counter value can also be captured by an edge of the z signal input selected according to by external trigger. table 14-3 interrupt factors interrupt factor description mode interrupt output status flag 1 event count interrupt when = 1, the encoder counter counts events (encoder pulses). when it has reached to the value programmed in , an interrupt occurs. encoder mode and sensor mode (event count) = 1 and = 1 2 event interrupt (divide pulse) an interrupt occurs on each divided clock pulse (1 to 128 divide), which is derived by dividing the encoder pulse by a factor programmed in . = 1 not available 3 event interrupt (capture interrupt) an interrupt occurs to indicate that an event (encoder pulse) has occurred, causing the counter value to be cap- tured on the rotation pulse timing. sensor mode (timer count) = 1 not available 4 abnormal detection time error interrupt when = 1, the enc uses a counter that counts up with fsys and is cleared by an event (encoder pulse). if no event occurs for a period of time programmed in , an inter- rupt occurs. = 1 and = 1 5 timer compare interrupt when = 1, an interrupt occurs when the timer has reached to the value programmed in . timer mode = 1 and = 1 6 capture interrupt an interrupt occurs when the counter value has been captured on an exter- nal trigger (z input). = 1 not available
page 14-24 14. encoder input circuit (enc) 14.6 function TMPM372FWUG 2013/4/15
TMPM372FWUG 2013/04/15 page 15-1 15. power-on reset circuit (por) the power-on reset circuit generates a reset when the power is turned on. when the supply voltage is lower than the detection voltage of the power-on re set circuit, a power-on reset signal is generated. 15.1 configuration the power-on reset circuit consists of a refe rence voltage generation circuit, a comparator and a power-on counter . the supply voltage divided by ladder resistor is co mpared with the voltage generated by the reference voltage generation circuit by the comparator. figure 15-1 power-on reset circuit 15.2 function when power supply voltage goes on, if the supply vo ltage is equal to or lower than the releasing voltage of the power-on reset circuit, a power-on reset signal is generated. if the power supply voltage exceeds the releasing voltage of the power-on reset ci rcuit, power-on counter is activated and 2 15 /f osc2 (s) later, a power-on reset signal is released. when power supply voltage goes down, if the suppl y voltage is equal to or lower than the detecting voltage of the power-on reset circuit, a power-on reset signal is generated. during the generation of power-on reset, the power- on counter circuit, the cpu and peripheral circuits are reset. when the power-on reset circuit is activated without an external reset input signal, the supply voltage should be increased to the recommended operating vo ltage range (note) within 3ms from the detection of the releasing voltage of the power-on reset circui t. if the supply voltage does not reach the range, the tmpm372 cannot operate properly. power-on reset signal   reference voltage fosc2 power-on detection signal powe r -on counte r rvdd5
15 power-on reset circuit (por) TMPM372FWUG 2013/04/15 page 15-2 note 1: the power-on reset circuit may operate improperly, depend ing on fluctuations in the suppl y voltage. refer to the electr ical characteristics and take them into consideration when designing equipment. note 2: if the supply voltage is lower than the minimum voltage of power-on reset circuit in which the circuit cannot operate properly, the power-on reset signal becomes undefined value. figure 15-2 operation timing of power-on reset symbol parameter min typ. max unit v porh power-on reset releasing voltage 2.8 3 3.2 v v porl power-on reset detection voltage 2.6 2.8 3.0 v t pordt1 power-on reset release response time 30 s t pordt2 power-on reset detection response time 30 s t porpw power-on reset minimum pulse width 45 s note 1 : since the power-on reset releasing voltage and t he power-on reset detection voltage relatively change, the detection voltage is never reversed. for the details about power-on sequence, refer to the chapter of ?electrical characteristics?. for the details about how to use external reset inpu t, refer to ?reset except ions? in the chapter of ?exceptions?. supply voltage v porh t pordt1 power-on detection signal v porl minimum voltage of t pordt2 t porpw power-on reset signal (low-level enable) power-on counter ~~ t pwup t pwup t pordt1 4.5v
TMPM372FWUG 2013/04/15 page 16-1 16. voltage detection circuit (vltd) the voltage detection circuit detects any decreas e in the supply voltage and generates voltage detection reset signals note: the voltage detection circuit may operate improperly, dependi ng on fluctuations in the supply voltage (rvdd5). refer to the electrical characteristics and take them into consideration when designing equipment. 16.1 configuration the voltage detection circuit consists of a refe rence voltage generation ci rcuit, a detection voltage level selection circuit, a comparator and control registers. the supply voltage (rvdd5) is divided by the ladder resistor and input to the detection voltage selection circuit. the detection voltage selection circ uit selects a voltage according to the specified detection voltage (vdlvl), and the comparator compares it with the reference voltage. when the supply voltage (rvdd5) becomes lowe r than the detection voltage (vdlvl), a voltage detection reset signal is generated. figure 16-1 voltage detection circuit volta g e detection reset   reference voltage g eneration circuit vdcr vden detection voltage level selection circuit vdlvl0 vdlvl1 rvdd5
16 voltage detection circuit (vltd) TMPM372FWUG 2013/04/15 page 16-2 16.2 control the voltage detection circuit is controlle d by voltage detection control registers. voltage detection control register 7 6 5 4 3 2 1 0 bit symbol - - - - - vdlvl1 vdlvl0 vden read/write r r r r r r/w r/w vdcr (0x4004_0900) after reset 0 0 0 0 0 00 0 vdlvl[1:0] selection for detection voltage 00 : reserved 01 : 4.1 0.2 v 10 : 4.4 0.2 v 11 : 4.6 0.2 v vden enables/disables the operation of voltage detection 0 : disables the operation of voltage detection 1 : enables the operation of voltage detection note 1: vdcr is initialized by a power-on reset or an external reset input. 16.3 function the detection voltage can be selected by vdcr. enabling/disab ling the voltage detection can be programmed by vdcr. after the voltage detection operation is enabled, when the supply voltage (rvdd5) becomes lower than the detection voltage , a vo ltage detection reset signal is generated. 16.3.1 enabling/disabling the voltage detection operation setting vdcr to "1" enables the voltage detect ion operation. setting it to "0" disables the operation. vdcr is cleared to "0" immediately after a po wer-on reset or a reset by an external reset input is released. note: when the supply voltage (rvdd5) is lower than the detecti on voltage (vdlvl), setting vdcr to "1" generates reset signal at the time.
TMPM372FWUG 2013/04/15 page 16-3 16.3.2 selecting the detection voltage level select a detection voltage at vdcr. power voltage vltd etection voltage tvdpw voltage detection voltage detection reset signal tvddt1 tvddt2 power-on reset signal tvden por etection voltage software software tvddt1 tvden figure 16-2 voltage detection timing symbol parameter min typ. max unit t vden setup time after enabling voltage detection 40 s t vddt1 voltage detection response time 40 s t vddt2 voltage detection releasing time 40 s t vdpw voltage detection minimum pulse width 45 s
page 17-1 TMPM372FWUG 2013/4/15 17. oscillation frequency detector (ofd) 17.1 configuration the oscillation frequency detector generates a reset for i/o if the oscillation of high frequency for cpu clock ofdmnpllexceeds the detection frequency range. the oscillation frequency detection is controlled by ofdcr1, ofdcr2 registers and the detection frequency range is specified by ofdmnp lloff/ofdmnpllon/ofdmxplloff/ofd mxpllon which are the detec- tion frequency setting registers. the lower detectio n frequency is specified by ofdmnplloff/ofdmnpllon registers and the higher detection frequency is sp ecified by ofdmxplloff/ofdmxpllon registers. when the oscillation frequency detection is en abled, writing to ofdmnp lloff/ofdmnpllon/ofdmx- plloff/ofdmxpllon registers is disabled. therefore, the setting the det ection frequency to these registers should be done when the oscillation frequency detection is disabled. and writing to ofdcr2/ofdmnplloff/ ofdmnpllon/ofdmxplloff/ofdmxpllon registers is controlled by ofdcr1 register. to write ofdcr2/ofdmnplloff/ofdmnpllon/ofdmxplloff/of dmxpllon registers, the write enable code "0xf9" should be set to ofdcr1 beforehand. to enable the oscillation frequency detector, set "0xe4" to ofdcr2 after setting "0xf9" to ofdcr1. since the oscillation freque ncy detection is disabled af ter an external reset input, power on reset or vltd reset, write "0xf9" to ofdcr1 an d write "0xe4" to ofdcr2 register to enable its func- tion. when the TMPM372FWUG detects the out of frequency by lower and higher detection frequency setting regis- ters, all i/os become high impedance by reset. in case of plloff, ofdmnplloff and ofdmxplloff regis- ters are valid for detection and the setting value of ofdmnpllon/ofdmxpllon regi sters are ignored. in case of pllon, ofdmnpllon and ofdmxpll on registers are valid for detection and the setting value of ofdm- nplloff/ofdmxplloff registers are ignored. by the osci llation frequency detection reset, all i/os except power supply pins, reset , x1 and x2 become high impedance. if oscill ation frequency detection reset is generated by detecting the stopping of high frequency, the internal circ uities such as registers hold the condition at the timing of oscillation stop. to initialize thes e internal circuitries, an external re-starting of oscillation is needed. since all registers for oscillation frequency detector (ofdcr1/ofdcr2/o fdmnplloff/ofdmnpllon/ ofdmxplloff/ofdmxpllon) are not init ialized by the reset generated from oscillation frequency detector, the detection of oscillation is keeps its function during the reset period of oscillation fr equency detection. therefore, if the oscillation frequency detection reset occurs, the rese t is not released unless the cpu clock resumes its normal frequency. note 1: the oscillation frequency detection reset is availabl e only in normal and idle modes. in stop mode, the oscil- lation frequency detection reset is disabled automatically. note 2: when the pll is controlled (enabled or disabled) by the cgpllsel register, the ofd must be disabled before- hand. if ofd reset is generated with pll-on, the detect ion frequency setting registers (ofdmnpllon/ofdmx- pllon) are automatically switched over to ofdmnplloff/ofdmxplloff.
page 17-2 17. oscillation frequency detector (ofd) 17.1 configuration TMPM372FWUG 2013/4/15 figure 17-1 example of detection frequency range figure 17-2 oscillation frequency detector fc [mhz] 10 18 5 5.5 subharmonics of 10mhz  harmonics of 10mhz-10% detection area 10mhzr vdd [v] 911 4.5 5.5 20 (a) in case of plloff fc [mhz] 80 144 40 44 subharmonics of 80mhz  harmonics of 80mhz-10% detection area 80mhzr vdd [v] 72 88 4.5 5.5 160 (b) in case of pllon fc xen oscillation frequency detection reset high frequency oscillator x1 x2 pll oscillation frequency detector pllon pllsel
page 17-3 TMPM372FWUG 2013/4/15 17.2 control the oscillation frequency detection is controlled by osci llation frequency detection control register 2 (ofdcr2). the detection frequency is specified by lower/higher detection frequency setting registers (ofdmnplloff, ofd- mnpllon, ofdmxplloff and ofdmxpllon). wr iting to ofdcr2/ofdmnplloff/ofdmnpllon/ ofdmxplloff/ofdmxpllon is contro lled by oscillation frequency control register 1 (ofdcr1). note 1: only "0x06" and "0xf9" is valid to ofdcr1. if other value than "0x06" and "0xf9" is written to ofdcr1, "0x06" is written to ofdcr1 automatically. note 2: ofdcr1 is initialized by the reset pin, power on reset or vltd reset. note 1: only "0x00" and "0xe4" is valid to ofdcr2. writing other value than "0x00" and "0xe4" to ofdcr2 is ignored. note 2: writing to ofdcr2 is protected by setting "0x06" to ofdcr1 but reading from ofdcr2 is always enabled with- out setting of ofdcr1. note 3: ofdcr2 is initialized by the reset pin, power on reset or vltd reset. oscillation frequency dete ction control register 1 31-8 ofdcr1 bit symbol - (0x4004_0800) read/write r after reset 0 76543210 bit symbol ofdwen 7 ofdwen 6 ofdwen 5 ofdwen 4 cofdwe n3 ofdwen 2 ofdwen 1 ofdwen 0 read/write r/w r/w r/w r/w r/w r/w r/w r/w a f t e r r e s e t00000110 function 0x06: disabling of writing to ofdcr2 /ofdmnplloff/ofdmnpllon/ofdmxplloff/ ofdmxpllon (write disable code) 0xf9: enabling of writing to ofdcr2/ofdmnplloff/ofdmnpllon/ofdmxplloff/ ofdmxpllon (write enable code) others: reserved (note 1) oscillation frequency dete ction control register 2 31-8 ofdcr2 bit symbol - (0x4004_0804) read/write r after reset 0 76543210 bit symbol ofdsen7 ofdsen6 ofdsen5 o fdsen4 ofdsen3 ofdsen2 ofdsen1 ofdsen0 read/write r/w r/w r/w r/w r/w r/w r/w r/w a f t e r r e s e t00000000 function 0x00: disabling of oscillation frequency detection 0xe4: enabling of oscillation frequency detection others: reserved (note 1) lower detection frequency setting register (in case of pll off) 31-9 8 ofdmnplloff bit symbol - ofdmnplloff (0x4004_0808) read/write r r/w after reset 0 0 76543210 bit symbol ofdmnplloff read/write r/w r/w r/w r/w r/w r/w r/w r/w a f t e r r e s e t00011010
page 17-4 17. oscillation frequency detector (ofd) 17.2 control TMPM372FWUG 2013/4/15 note 1: the after reset value is a tentative value. note 2: ofdmnplloff, ofdmnpllon, ofdmxplloff and ofdmxp llon can not be written when the oscillation frequency detection circuit is enabled (ofdcr2="0xe4 ") or writing is disabled with ofdcr1="0x06". an attempt to write ofdmn- plloff, ofdmnpllon, ofdmxplloff and ofdm xpllon can not complete a write operation. note 3: writing to ofdmnplloff, ofdmnpllon, ofdmxpllof f and ofdmxpllon is protected by setting "0x06" to ofdcr1 but reading from ofdmnplloff, ofdmnpllon, ofdmxplloff and ofdmxpllon is always enabled without setting of ofdcr1. note 4: specify an appropriate value to ofdmnplloff and ofdmxplloff depending on the clock frequency to be used under the condition of ofdmnplloff page 17-5 TMPM372FWUG 2013/4/15 17.3 function 17.3.1 enabling and di sabling the oscillat ion frequency detection writing "0xe4" to ofdcr2 with ofdcr1="0xf9" enable s the oscillation frequency detection, and writing "0x00" to ofdcr2 with ofdcr1="0xf9" disables the oscillation frequency detection. registers of ofd are initialized by the reset pin, power on reset or vltd reset. since ofdcr1 is initialized to "0x06" and ofdcr2 is initialized to "0x00" by resets shown above, oscilla- tion frequency detection and writing to the registers ar e desabled. reading from of dcr2 is always enabled without setting of ofdcr1. note:after writing data to ofdcr2, set "0x06" to ofdcr1 to protect ofdcr2 register. when stop mode is executed with ofdcr2=0xe4, the oscillation frequency detection is automatically dis- abled. after releasing stop and warming up period, the oscillation frequency detection is enabled. the oscil- lation frequency detection is available only in normal and idle mode. table 17-1 shows the availability of oscillation frequency detector. figure 17-3 availability of oscillation frequency detection table 17-1 availability of os cillation frequency detector operating mode oscillation frequency detection (ofdcr2=0xe4) all i/os condition after oscillation frequency detection reset (except power supply, reset , x1, x2 pins) normal available high impedance idle available high impedance stop (including warming up period) oscillation frequency detection is disabled automatically. reset by oscillation frequency detection reset available high impedance watchdog timer reset sysresetreq reset available high impedance reset by external reset power on reset vltd reset disable -
page 17-6 17. oscillation frequency detector (ofd) 17.3 function TMPM372FWUG 2013/4/15 17.3.2 setting the lower and higher frequency for detection the higher and lower limit of the detection frequency is calculated from the maximum error of the target clock and the reference. the reference clock frequency is 9.5 mhz and the error is 10%. how to calculate the setup value is shown below. 17.3.3 oscillation freq uency detection reset if the TMPM372FWUG detects lo wer frequency specified by ofdmnplloff/ofdmnpllon or higher frequency specified by ofdmxplloff /ofdmxpllon, the oscillation frequency detector outputs a reset signal for all i/os. a. when the high frequency os cillation becomes abnormal when an abnormal (lower or higher) frequency oscillation continues for some period (t ofd ), the oscillation frequency detection reset is generated. by oscillation frequency detection reset initializes all i/os except power supply pins, reset , x1 and x2 become high impedance. b. when the high frequency oscillation stops when the high frequency oscillation stops for some period (t ofd ), the oscillation frequency detec- tion reset is generated. by oscilla tion frequency detection reset initializes all i/os except power sup- ply pins, reset , x1 and x2 become high impedance. howeve r, since the internal circuitries such as cpu are initialized by a reset signal latched by high frequency, the internal circuitries hold the state at the oscillation frequency detection. when the oscillation resumes its normal frequency and continues for some period (t ofd ), the oscillation fre- quency detection reset is released. a) target clock max. b) min. c) reference clock max. (10.5mhz) d) min. (8.5mhz) higher limit of the detection frequency = 1 { (d 2 7 ) (a 4) } (truncate after the decimal places) lower limit of the detection frequency = 1 { (c 2 7 ) (b 4) } (round up after the decimal places)
page 18-1 TMPM372FWUG 2013/4/15 18. watchdog timer(wdt) the watchdog timer (wdt) is for detecting malfunctions (run aways) of the cpu caused by noises or other distur- bances and remedying them to return the cpu to normal operation. if the watchdog timer detects a runaway, it generates a intwdt interrupt or reset. note: intwdt interrupt is a factor of the non-maskable interrupts (nmi). also, the watchdog timer notifies of the detecting malfuncti on to the external peripheral devices from the watch- dog timer pin ( wdtout ) by outputting "low". note: this product does not have the watchdog timer out pin ( wdtout ). 18.1 configuration figure 18-1shows the block diagram of the watchdog timer. figure 18-1 block diagr am of the watchdog timer wdmod to internal reset reset pin watchdog timer out control wdtout q rs selector binary counter 2 15 /fsys 2 17 /fsys 2 19 /fsys 2 21 /fsys 2 23 /fsys 2 25 /fsys wdmod fsys wdmod watch dog timer control register wdcr reset write ?0xb1? write ?0x4e? internal data bus internal reset watchdog timer interrupt intwdt
page 18-2 18. watchdog timer(wdt) 18.2 register TMPM372FWUG 2013/4/15 18.2 register the followings are the watchdog time r control registers and addresses. 18.2.1 wdmod(watchdog timer mode register) note: intwdt interrupt is a factor of the non-maskable interrupts (nmi). base address = 0x4004 _ 0000 register name address(base+) watchdog timer mode register wdmod 0x0000 watchdog timer control register wdcr 0x0004 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol wdte wdtp - i2wdt rescr - after reset10000010 bit bit symbol type function 31-8 ? r read as 0. 7 wdte r/w enable/disable control 0:disable 1:enable 6-4 wdtp[2:0] r/w selects wdt detection time(refer totable 18-1) 000: 2 15 /fsys 001: 2 17 /fsys 010: 2 19 /fsys 011: 2 21 /fsys 100: 2 23 /fsys 101: 2 25 /fsys 110:setting prohibited. 111:setting prohibited. 3 ? r read as 0. 2 i2wdt r/w operation when idle mode 0: stop 1:in operation 1 rescr r/w operation after detecting malfunction 0: intwdt interrupt request generates. (note) 1: reset 0 ? r/w write 0.
page 18-3 TMPM372FWUG 2013/4/15 18.2.2 wdcr (watchdog ti mer control register) table 18-1 detection time of watchdog timer (fc = 80mhz) clock gear value cgsyscr wdmod 000 001 010 011 100 101 000 (fc) 0.41 ms 1.64 ms 6.55 ms 26.21 ms 104.86 ms 419.43 ms 100 (fc/2) 0.82 ms 3.28 ms 13.11 ms 52.43 ms 209.72 ms 838.86 ms 101 (fc/4) 1.64 ms 6.55 ms 26.21 ms 104.86 ms 419.43 ms 1.68 s 110 (fc/8) 3.28 ms 13.11 ms 52.43 ms 209.72 ms 838.86 ms 3.36 s 111 (fc/16) 6.55 ms 26.21 ms 104.86 ms 419.43 ms 1.68 s 6.71 s 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol wdcr after reset-------- bit bit symbol type function 31-8 ? r read as 0. 7-0 wdcr w disable/clear code 0xb1:disable code 0x4e: clear code others:reserved
page 18-4 18. watchdog timer(wdt) 18.3 operations TMPM372FWUG 2013/4/15 18.3 operations 18.3.1 basic operation the watchdog timer is consists of the binary counters that work using the system clock (fsys) as an input. detecting time can be selected between 2 15 , 2 17 , 2 19 , 2 21 , 2 23 and 2 25 by the wdmod. the detecting time as specified is elapsed, the watchdog timer interrupt (intwdt) generates, and the watchdog timer out pin ( wdtout ) output "low". to detect malfunctions (runaways) of the cpu caused by noise or other disturbances, the binary counter of the watchdog timer should be cleared by software instru ction before intwdt interrupt generates. if the binary counter is not cleared, the non-maskable interrupt ge nerates by intwdt. thus cpu detects malfunction (run- way), malfunction countermeasure program is performed to return to the normal operation. additionally, it is possible to resolve the problem of a malfunction (runaway) of the cpu by connecting the watchdog timer out pin to reset pins of peripheral devices. note:this product does not include a watchdog timer out pin ( wdtout ). 18.3.2 operation mode and status the watchdog timer begins operation immediately after a reset is cleared. if not using the watchdog timer, it should be disabled. the watchdog timer cannot be used as the high-speed frequency clock is stopped. before transition to below modes, the watchdog timer should be disabled.in idle mode, its operation depends on the wdmod setting. -stop mode also, the binary counter is automatically stopped during debug mode.
page 18-5 TMPM372FWUG 2013/4/15 18.4 operation wh en malfunction (run away) is detected 18.4.1 intwdt interrupt generation in the figure 18-2 shows the case that intwdt interrupt generates (wdmod="0"). when an overflow of the binary coun ter occurs, intwdt interrupt generates. it is a factor of non-maskable interrupt (nmi). thus cpu detects non-maskable in terrupt and performs the countermeasure program. the factor of non-maskable interrupt is the plural. c gnmiflg identifies the factor of non-maskable inter- rupts. in the case of intwdt in terrupt, cgnmiflg is set. when intwdt interrupt generates, simultaneously the watchdog timer out ( wdtout ) output "low". wdtout becomes "high" by the watchdog timer clearing that is writing clear code 0x4e to the wdcr regis- ter. note:this product does not have the watchdog timer output pin( wdtout ). figure 18-2 intwdt interrupt generation n overflow 0 wdt counter wdt clear intwdt write of a clear code wdtout
page 18-6 18. watchdog timer(wdt) 18.4 operation when malfunction (runaway) is detected TMPM372FWUG 2013/4/15 18.4.2 internal reset generation figure 18-3 shows the internal reset generation (wdmod="1"). mcu is reset by the overflow of the binary counter. in this case, reset status continues for 32 states. a clock is initialized so that input clock (fsys) is the same as a internal high-speed freque ncy clock (fosc). this means fsys = fosc. figure 18-3 inter nal reset generation n 32-state ( s @f osc = fsys = mhz) wdtout overflow wdt counter internal reset intwdt 3.2 10
page 18-7 TMPM372FWUG 2013/4/15 18.5 control register the watchdog timer (wdt) is controlled by two control registers wdmod and wdcr. 18.5.1 watchdog timer mode register (wdmod) 1. specifying the detection time of the watchdog timer . set the watchdog timer detecting time to wdmod. after reset, it is initialized to wdmod = "000". 2. enabling/disabling the watchdog timer . when resetting, wdmod is initialize d to "1" and the watchdog timer is enabled. to disable the watchdog timer to protect from the error writing by the malfunction, first bit is set to "0", and then the disable code (0xb1) must be written to wdcr register. to change the status of the watchdog timer from "disable" to "enable," set the bit to "1". 3. watchdog timer out reset connection this register specifies whether wdtout is used for internal reset or interrupt. after reset, wdmod is initialized to "1", the intern al reset is generated by the overflow of binary counter. 18.5.2 watchdog timer control register(wdcr) this is a register for disabling the watchdog timer f unction and controlling the clearing function of the binary counter.
page 18-8 18. watchdog timer(wdt) 18.5 control register TMPM372FWUG 2013/4/15 18.5.3 setting example 18.5.3.1 disabling control by writing the disable code (0xb1) to this wdcr register after setting wdmod to "0," the watchdog timer can be disabled and the binary counter can be cleared. 18.5.3.2 enabling control set wdmod to "1". 18.5.3.3 watchdog timer clearing control writing the clear code (0x4e) to the wdcr register cl ears the binary counter and it restarts counting. 18.5.3.4 detection time of watchdog timer in the case that 2 21 /fsys is used, set "011" to wdmod. 76543210 wdmod 0 ??????? set to "0". wdcr 10110001writes the disable code (0xb1). 76543210 wdmod 1 ??????? set to "1". 76543210 wdcr 01001110writes the clear code (0x4e). 76543210 wdmod 1 011????
page 19-1 TMPM372FWUG 2013/4/15 19. flash this section describes the hardware configuration and operation of the flash memory. 19.1 flash memory 19.1.1 features 1. memory capacity TMPM372FWUG contains flash memory. the memory sizes and configurations are shown in the table below. independent write access to each bloc k is available. when the cpu is to access the internal flash memory, 32-bit data bus width is used. 2. write / erase time writing is executed per page. TMPM372FWUG contains 64 words. page writing requires 1.25ms (typical) regardless of number of words. a block erase requires 0.1 sec. (typical). the following table shows writ e and erase time per chip. note: the above values are theoretical values not including data transfer time. the write time per chip depends on the write method to be used by users. 3. programming method there are two types of the onboard programming mode for users to program (rewrite) the device while it is mounted on the user's board: a. user boot mode the use?s original rewriting method can be supported. b. single boot mode the rewriting method to use serial data transfer (toshiba's unique method) can be supported. product name memory size block configuration # of words write time erase time 128 kb 64 kb 32 kb 16 kb TMPM372FWUG 128 kb 0 1 1 2 64 0.64 sec 0.4 sec
page 19-2 19. flash 19.1 flash memory TMPM372FWUG 2013/4/15 4. rewriting method the flash memory included in this device is gene rally compliant with the applicable jedec stan- dards except for some specific functio ns. therefore, if a user is cu rrently using an external flash memory device, it is easy to implement the functions into this device. furthermore, the user is not required to build his/her own pr ograms to realize complicated write and erase functions because such functions are automatically perform ed using the circuits already built-in the flash memory chip. 5. protect/ security function this device is also implemented with a read-prot ect function to inhibit reading flash memory data from any external writer device. on the other hand, rewrite protection is available only through com- mand-based software programming; any hardware setting method to apply +12vdc is not sup- ported. see the chapter "rom pr otection" for details of rom protection and security function. note: if a password is set to 0xff (erased data), it is difficult to protect data securely due to an easy-to-guess password. even if single boot mode is not used, it is recommended to set a unique value as a password. jedec compliant functions modified, added, or deleted functions ? automatic programming ? automatic chip erase ? automatic block erase ? data polling / toggle bit block protect (only software protection is supported) erase resume - suspend function
page 19-3 TMPM372FWUG 2013/4/15 19.1.2 block diagram of t he flash memory section figure 19-1 block diagram of the flash memory section internal address bus internal data bus internal control bus control address data flash memory rom controller control circuit (includes automatic sequence control) command register address latch data latch column decoder / sense amplifer row decoder flash memory cell erase block decoder
page 19-4 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2 operation mode this device has three operation mo des including the mode not to use the internal flash memory. among the flash memory operation modes listed in the abov e table, the user boot mode and the single boot mode are the programmable modes. these two modes, the user boot mode and the single boot mode, are referred to as "onboard programming" modes where onboard rewriting of in ternal flash memory can be made on the user's set. either the single chip or single bo ot operation mode can be selected by externally setting the level of the boot (pf0) pin while the device is in reset status. figure 19-2 mode transition diagram table 19-1 operation modes operation mode operation details single chip mode after reset is cleared, it starts up from the internal flash memory. normal mode in this operation mode, two different m odes, i.e., the mode to execute user application pro- grams and the mode to rewrite the flash memory onboard the user?s set, are defined.the former is referred to as "normal mode" and the latter "user boot mode". user boot mode a user can uniquely configure the syst em to switch between these two modes. for exam- ple, a user can freely design the system such that the normal mode is selected when the port "a0" is set to "1" and the user boot mode is selected when it is set to "0". a user should prepare a routine as part of the application program to make the decision on the selection of the modes. single boot mode after reset is cleared, it starts up from the internal boot rom (mask rom). in the boot rom, an algorithm to enable flash memory rewriting on the user?s set through the serial port of this device is programmed. by connecti ng to an external host computer through the serial port, the internal flash memory can be programmed by transferring data in accor- dance with predefined protocols. table 19-2 operating mode setting operation mode pin reset boot (pf0) single chip mode 0 11 single boot mode 0 10 user to set the switch method normal mode user boot mode reset state single boot mode onboard programming mode single chip mode
page 19-5 TMPM372FWUG 2013/4/15 19.2.1 reset operation to reset the device, ensure that the power supply voltage is within the operating voltage range, that the inter- nal oscillator has been stabilized, and that the reset input is held at "0" for a minimum duration of 12 system clocks (0.15 s with 80mhz operation; the "1/1" clock gear mode is applied after reset). note 1: it is necessary to apply "0" to the reset inputs upon power on for a minimum duration of 700 s regardless of the operating frequency. note 2: while flash auto programming or erasing is in progress, at least 0.5 s of reset period is required regardless of the system clock frequency. in this condition, it takes approx. 2 ms to enable reading after reset. 19.2.2 user boot mode (single chip mode) user boot mode is to use flash memory programming routine defined by users. it is used when the data transfer buses for flash memory progra m code on the old application and for serial i/o are different. it operates at the single chip mode; therefore, a switch from normal mode in which user application is ac tivated at the sin- gle chip mode to user boot mode for programming fl ash is required. specifically, add a mode judgment rou- tine to a reset program in the user application. the condition to switch the modes needs to be set by using the i/o of TMPM372FWUG in conformity with the user?s system setup condition. also, flash memory programming routine that the user uniquely makes up needs to be set in the new applicati on. this routine is used for program ming after being switched to user boot mode. the execution of the programming routine must take place while it is stored in the area other than the flash memory since the data in the internal flash memory cannot be read out during delete / writing mode. once re-programming is complete, it is r ecommended to protect relevant flas h blocks from accidental corruption during subsequent single-chip (normal mode) operations. be sure not to cause any exceptions including a non-maskable while user boot mode. (1-a) and (1-b) are the examples of programming with routines in the internal flash memory and in the external memory. for a detailed description of the er ase and program sequence, refer to "19.3 on-board pro- gramming of flash memory (rewrite/erase)".
page 19-6 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2.2.1 (1-a) method 1: storing a programming routine in the flash memory (1) step-1 determine the conditions (e.g., pi n states) required for the flash memory to enter user boot mode and the i/o bus to be used to transfer new prog ram code. create hardware and software accordingly. before installing the TMPM372FWUG on a printed circuit board, write the following program rou- tines into an arbitrary flash block using programming equipment. (a) mode judgment routine: code to determine whether or not to switch to user boot mode (b) programming routine: code to download new program code from a host controller and re-program the flash memory (c) copy routine: code to copy the data described in (b) from the TMPM372FWUG flash memory to either the TMPM372FWUG on-chip ram or external memory device. new application program code old application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) programming routine (c) copy routine ( TMPM372FWUG )
page 19-7 TMPM372FWUG 2013/4/15 (2) step-2 the following description is the case that programming routines are installed in the reset process- ing program. after reset pin is released, the reset procedure determines whether to put the TMPM372FWUG flash memory in user boot mode. if mode switching conditions are met, the flash memory enters user boot mode. (all interrupts including nmi must be not used while in user boot mode.) (3) step-3 once transition to user boot mode is occurred, execute the copy r outine (c) to copy the flash pro- gramming routine (b) to the TMPM372FWUG on-chip ram. new application program code old application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) programmming routine (c) copy routine 0 1 reset conditions for entering user boot mode (defined by the user) ( TMPM372FWUG ) new application program code old application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) programming routine (c) copy routine (b) programming routine ( TMPM372FWUG )
page 19-8 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 (4) step-4 jump program execution to the flash programming routine in the on-chip ram to clear write or erase protection and erase a flash block containing the old application program code. (5) step-5 continue executing the flash programming routine to download new program code from the host controller and program it into the erased flash bl ock. when the programming is completed, the writ- ing or erase protection of that flash bloc k in the user?s program area must be set. new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) programming routine (c) copy routine (b) programming routine (erased) ( TMPM372FWUG ) new application program code new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) programming routine (c) copy routine (b) programming routine ( TMPM372FWUG )
page 19-9 TMPM372FWUG 2013/4/15 (6) step-6 set reset to "0" to reset the TMPM372FWUG. upon reset, the on-chip flash memory is set to normal mode. after reset is released, the cpu will start ex ecuting the new application program code. new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) programming routine (c) copy routine 0 1 reset set to normal mode ( TMPM372FWUG )
page 19-10 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2.2.2 (1-b) method 2: transferring a programming routine from an external host (1) step-1 determine the conditions (e.g., pi n states) required for the flash memory to enter user boot mode and the i/o bus to be used to transfer new prog ram code. create hardware and software accordingly. before installing the TMPM372FWUG on a printed circuit board, write the following program rou- tines into an arbitrary flash block using programming equipment. also, prepare a programming routine shown below on the host controller: (a) mode judgment routine: code to determine whether or not to switch to user boot mode (b) transfer routine: code to download new program code from a host controller (c) programming routine: code to download new program code from an external host controller and re-program the flash memory new application program code flash memory (+rvw) (i/o) ram [reset procedure] (a) mode judgement routine (b) transfer routine old application program code (c) programming routine ( TMPM372FWUG )
page 19-11 TMPM372FWUG 2013/4/15 (2) step-2 the following description is the case that programming routines are installed in the reset process- ing program. after reset is released, the re set procedure determines whether to put the TMPM372FWUG flash memory in user boot mode. if mode switching conditions are met, the flash memory enters user boot mode. (all interrupts including nmi must be not used while in user boot mode). (3) step-3 once user boot mode is entered, execute the tran sfer routine (b) to down load the flash program- ming routine (c) from the host controller to the TMPM372FWUG on-chip ram. new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) transfer routine old application program code (c)programming routine 0 1 reset conditions for entering user boot mode (defined by the user) ( TMPM372FWUG ) new application program code flash memory (+rvw) (i/o) ram [reset procedure] (a) mode judgement routine (b) transfer routine old application program code (c) programming routine (c) programming routine ( TMPM372FWUG )
page 19-12 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 (4) step-4 jump program execution to the flash programming routine in the on-chip ram to clear write or erase protection and erase a flash block containing the old application program code. (5) step-5 continue executing the flash programming routine to download new program code from the host controller and program it into the erased flash bl ock. when the programming is completed, the writ- ing or erase protection of that flash bloc k in the user program area must be set. new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) transfer routine (c) programming routine (c) programming routine (erased) ( TMPM372FWUG ) new application program code flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) transfer routine new application program code (c) programming routine (c) programming routine ( TMPM372FWUG )
page 19-13 TMPM372FWUG 2013/4/15 (6) step-6 set reset to "0" low to reset the TMPM372FWUG. upon reset, the on-chip flash memory is set to normal mode. after reset is released, the cpu will start ex ecuting the new application program code. flash memory (host) (i/o) ram [reset procedure] (a) mode judgement routine (b) transfer routine new application program code 0 1 reset set to normal mode ( TMPM372FWUG )
page 19-14 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2.3 single boot mode in single boot mode, the flash memory can be re-programmed by using a program contained in the TMPM372FWUG on-chip boot rom. this boot rom is a masked rom. when single boot mode is selected upon reset, the boot rom is mapped to the address region including the interrupt vector table while the flash memory is mapped to an address region different from it. single boot mode allows for serial programming of the flash memory. channel 0 of the sio (sio0) of the TMPM372FWUG is connected to an external host controller. via this serial link, a programming routine is downloaded from the host controller to the TMPM372FWUG on-chip ram. then, the flash memory is re-pro- grammed by executing the programming routine. the host sends out both commands and programming data to re-program the flash memory. communications between the sio0 and the host must follow the protocol described later. to secure the contents of the flash memory, the validity of the application?s password is veri- fied before a programming routine is downloaded into the on-chip ram. if password matching fails, the trans- fer of a programming routine itself is aborted. as in the case of user boot mode, all interrupts including the non-maskable interrupt (nmi) must be disabled in single boot mode while the flash memory is being erased or programmed. in single boot mode, the boot-rom programs are executed in normal mode. once re-programming is complete, it is recommended to se t the write/erase protection to the relevant flash blocks from accidental corrupt ion during subsequent single-ch ip (normal mode) operations. 19.2.3.1 (2-a) using the program in the on-chip boot rom (1) step-1 the flash block containing the old version of the program code does not need to be erased before executing the programming routine. since a programming routine and programming data are trans- ferred via the sio (sio0), the si o0 must be connected to a host controller. prepare a programming routine (a) on the host controller. new application program code flash memory (host) (i/o) ram boot rom old application program code (or erased state) sio0 (a)programming routine ( TMPM372FWUG )
page 19-15 TMPM372FWUG 2013/4/15 (2) step-2 set the reset pin to "1" to cancel the reset of the 5.1.'86( when the boot pin has already been set to "0". after reset, cpu reboots from the on-chip boot rom. the 12-byte password trans- ferred from the host controller via sio0 is firstly compared to the contents of the special flash mem- ory locations. (if the flash block has already been erased, the password is 0xff). (3) step-3 if the password is correct, the boot program downloads the programming routine (a) from the host controller into the on-chip ram of the tmpm372f wug. the programming routine must be stored in the range from 0x2000_0400 to the end address of ram. new application proram code flash memory (host) (i/o) ram (a) programming routine boot rom old application program code (or erased state) sio0 0 1 reset 0 boot ( TMPM372FWUG ) new application program code flash memory (host) (i/o) ram boot rom old application program code (or erased state) sio0 (a) programming routine (a) programming routine ( TMPM372FWUG )
page 19-16 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 (4) step-4 the cpu jumps to the programming routine (a) in the on-chip ram to erase the flash block con- taining the old application progr am code. the block erase or chip erase command may be used. (5) step-5 next, the programming routine (a) downloads new application program code from the host con- troller and programs it into the erased flash block. when the programming is completed, the writing or erase protection of that flash block in the user?s program area must be set. in the example below, new prog ram code comes from the same host controller via the same sio0 channel as for the programming routine. however, once the programming routine has begun to exe- cute in the on-chip ram, it is fr ee to change the transfer path an d the source of the transfer. create board hardware and a programming routine to suit your particular needs. 1hz$ssolfdwlrq 3urjudp&rgh )odvkphpru\ (+rvw) (i/o) ram %227520 sio0 (a) programming routine (a)3urjudpplqj5rxwlqh (udvhg ( TMPM372FWUG ) new application program code flash memory (host) (i/o) ram boot rom new application program code sio0 (a) programming routine (a) programming routine ( TMPM372FWUG )
page 19-17 TMPM372FWUG 2013/4/15 (6) step-6 when programming of the flash memory is comp lete, power off the boar d and disconnect the cable between the host and the target board. turn on the power again so th at the TMPM372FWUG re- boots in single-chip (normal) mode to execute the new program. 19.2.4 configuration for single boot mode to execute the on-board programming, boot the TMPM372FWUG with single boot mode following the configuration shown below. set the reset input to "0", and set the each boot (pf0) pins to values shown above, and then release reset pin (high). boot (pf0) = 0 reset = 0 1 flash memory (host) (i/o) ram boot rom new application program code sio0 0 1 reset set to single-chip mode (boot=1) ( TMPM372FWUG )
page 19-18 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2.5 memory map figure 19-3 shows a comparison of the memory maps in normal and single boot modes. in single boot mode, the internal flash memory is mapped to 0x3f80_0000 and later addresses, and the internal boot rom (mask rom) is mapped to 0x0000_0000 through 0x0000_0fff. the internal flash memory and ram ad dresses of each device are shown below. figure 19-3 memory maps for TMPM372FWUG product name flash size ram size flash address (single chip / single boot mode) ram address TMPM372FWUG 128 kb 6 kb 0x0000_0000 to 0x0001_ffff 0x3f80_0000 to 0x3f81_ffff 0x2000_0000 to 0x2000_17ff 0xffff_ffff single chip mode internal ram (6 kb) internal flash rom (128 kb) 0x2000_17ff 0x2000_0000 0x0001_ffff 0x0000_0000 sfr 0x41ff_ffff 0x4000_0000 0xffff_ffff single boot mode internal ram (6 kb) internal boot rom (4 kb) 0x2000_17ff 0x2000_0000 0x0000_0fff 0x0000_0000 sfr 0x41ff_ffff 0x4000_0000 internal flash rom (128 kb) 0x3f81_ffff 0x3f80_0000 reserved 0x3f7f_f000
page 19-19 TMPM372FWUG 2013/4/15 19.2.6 interface specification in single boot mode, an sio channel is used for communications with a programming controller. the same configuration is applied to a communication format on a programming controller to execute the on-board pro- gramming. both uart (asynchronous) and i/o interf ace (synchronous) modes are supported. the communi- cation formats are shown below. ? uart communication communication channel : sio channel 0 serial transfer mode : uart (async hronous) mode, half -duplex, lsb first data length : 8 bits parity bit : none stop bit : 1 bit baud rate : arbitrary baud rate ? i/o interface mode communication channel : sio channel 0 serial transfer mode : i/o interf ace mode, full -duplex, lsb first synchronization clock (sclk0) : input mode handshaking signal : pe4 configured as an output mode baud rate : arbitrary baud rate 19.2.7 data transfer format table 19-4, table 19-6 to table 19-7 illustrate the ope ration commands and data transfer formats at each operation mode. in conjunction with this section, refer to "19.2.10 operation of boot program". table 19-3 required pin connections pin interface uart i/o interface mode power supply pins dvdd5 ? dvss ? avdd5b ? avssb ? vout3 ? vout15 ? rvdd5 ? mode-setting pin boot (pf0) ? reset pin reset ? communication pin txd0 (pe0) ? rxd0 (pe1) ? sclk0 (pe2) (input mode) pe4 (output mode)
page 19-20 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2.8 restrictions on internal memories single boot mode places restrictions on the internal ram and rom as shown in table 19-5. 19.2.9 transfer form at for boot program the following tables shows the tran sfer format for each boot program command. use this section in con- junction with chapter "19.2.10 operation of boot program". table 19-4 single boot mode commands code command 0x10 ram transfer 0x40 chip and protection bit erase table 19-5 restrictions in single boot mode memory details internal ram a program contained in the boot rom uses the area, through 0x2000_0000 to 0x2000_03ff, as a work area. store the ram transfer program from 0x2000_0400 through the end address of ram. internal rom the following addresses are assigned for storing software id information and passwords. storing program in these addresses is not recommendable. 0x3f81_fff0 to 0x3f81_ffff
page 19-21 TMPM372FWUG 2013/4/15 19.2.9.1 ram transfer note 1: in i/o interface mode, the baud rate for the transfers of the first and second bytes must be 1/16 of the desired baud rate. note 2: in case of any negative acknowledge, the boot program returns to a state in which it waits for a command code (3rd byte). in i/o interface mode, if a communication error occurs, a negative acknowledge does not occur. note 3: the 19th to 25th bytes must be within the ram address range from 0x2000_0400 through the end address of ram. table 19-6 transfer format for the ram transfer command byte data transferred from the controller to the TMPM372FWUG baud rate data transferred from the TMPM372FWUG to the controller boot rom 1 byte serial operation mode and baud rate for uart mode : 0x86 for i/o interface mode : 0x30 desired baud rate (note 1) ? 2 byte ? ack for the serial operation mode byte ? for uart mode - normal acknowledge : 0x86 (the boot program aborts if the baud rate can not be set correctly.) ? for i/o interface mode - normal acknowledge :0x30 3 byte command code (0x10) ? 4 byte ? ack for the command code byte (note 2) - normal acknowledge : 0x10 - negative acknowledge : 0xx1 - communication error : 0xx8 5 byte to 16 byte password sequence (12 bytes)) 0x3f81_fff4 to 0x3f81_ffff ? 17 byte check sum value for bytes 5 to 16 ? 18 byte ? ack for the checksum byte (note 2) - normal acknowledge : 0x10 - negative acknowledge : 0xx1 - communication error : 0xx8 19 byte ram storage start address 31 to 24 ? 20 byte ram storage start address 23 to 16 ? 21 byte ram storage start address 15 to 8 ? 22 byte ram storage start address 7 to 0 ? 23 byte ram storage start address 15 to 8 ? 24 byte ram storage start address 7 to 0 ? 25 byte check sum value for bytes 19 to 24 ? 26 byte ? ack for the checksum byte (note 2) - normal acknowledge : 0x10 - negative acknowledge : 0xx1 - communication error : 0xx8 27 byte to mbyte ram storage data ? m + 1 byte checksum value for bytes 27 to m ? m + 2 byte ? ack for the checksum byte (note 2) - normal acknowledge : 0x10 - negative acknowledge : 0xx1 - communication error : 0xx8 ram m + 3 byte ? jump to ram storage start address
page 19-22 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2.9.2 chip erase and protect bit erase note 1: in i/o interface mode, the baud rate for the transfers of the first and second byte must be 1/16 of the desired baud rate. note 2: in case of any negative acknowledge, the boot program returns to a state in which it waits for a command code (3rd byte). in i/o interface mode, if a communication error occurs, a negative acknowledge does not occur. table 19-7 transfer format for the chip and protection bit erase command byte data transferred from the controller to the TMPM372FWUG baud rate data transferred from the TMPM372FWUG to the controller boot rom 1 byte serial operation mode and baud rate for uart mode : 0x86 for i/o interface mode : 0x30 desired baud rate (note 1) ? 2 byte ? ack for the serial operation mode byte ? for uart mode - normal acknowledge : 0x86 (the boot program aborts if the baud rate can not be set correctly.) ? for i/o interface mode - normal acknowledge :0x30 3 byte command code (0x40) ? 4 byte ? ack for the command code byte (note 2) - normal acknowledge : 0x40 - negative acknowledge : 0xx1 - communication error : 0xx8 5 byte chip erase command code (0x54) ? 6 byte ? ack for the command code byte (note 2) - normal acknowledge : 0x40 - negative acknowledge : 0xx1 - communication error : 0xx8 7 byte ? ack for the chip erase command code byte - normal acknowledge : 0x4f - negative acknowledge : 0x4c 8 byte (wait for the next command code.) ?
page 19-23 TMPM372FWUG 2013/4/15 19.2.10operation of boot program when single boot mode is selected, the boot progra m is automatically executed on startup. the boot pro- gram offers these four commands , of which the details are provi ded on the following subsections. 1. ram transfer command the ram transfer command stores program code tr ansferred from the host controller to the on- chip ram and executes the program once the transfer is successfully completed. the user program ram space can be assigned to the range from 0x2000_0400 to the end address of ram, whereas the boot program area (0x2000_0000 to 0x2000_03ff) is unavailable. the user program starts at the assigned ram address. the ram transfer command can be used to down load a flash programming routine of your own; this provides the ability to control on-board programming of the flash memory in a unique manner. the programming routine must ut ilize the flash memory command sequences described in section 19.3. before initiating a transfer, the ram transf er command verifies a password sequence coming from the controller against that stored in the flash memory. note: if a password is set to 0xff (erased data), it is difficult to protect data securely due to an easy-to-guess password. even if single boot mode is not used, it is recommended to set a unique value as a password. 2. flash memory chip erase an d protection bit erase command this command erases the entire area of the flash memory automatically. all the blocks in the mem- ory cell and their protection conditions are erased ev en when any of the bloc ks are prohibited from writing and erasing. when the command is complete d, the fcsecbit bit is set to "1". this command serves to recover boot programming operation when a user forgets the password. therefore password veri fication is not executed.
page 19-24 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2.10.1ram transfer command see table 19-6 for the transfer format of this command. 1. the 1st byte specifies which one of the two serial operation modes is used. for a detailed description of how the serial operation mode is determined, see "19.2.10.4 determination of a serial operation mode" described later. if the mode is determined as uart mode, the boot pro- gram checks if the baud rate setting can be perf ormed. during the first-byte processing, receiv- ing operation is prohibited. (sc0mod0=0) ? to communicate in uart mode the 1st byte is set to "0x86" and is transmitted from the controller to the target board at the specified baud rate by setting uart. if the serial operation mode is determined as uart, then the boot program checks if the baud rate sett ing can be performed. if that baud rate can- not be set, the boot program aborts and an y subsequent communications cannot be done. please refer to "baud rate setting" for the me thod of judging whether the setting of the baud rate is possible. ? to communicate in i/o interface mode the 1st byte is set to "0x30" and is transmitted from the controller to the target board at 1/ 16 of the desired baud rate by the synchronous se tting. same as the 1st byte, a 1/16 of the specified baud rate is used in the 2nd transmission. from the 3rd byte (operation command data), users can transmit data at specified baud rate. in i/o interface mode, cpu consid ers the reception terminal to be an input port and moni- tors the level of i/o port. if the baud rate is high or operation frequency is high, cpu may not distinguish the level of i/o port. to avoid this situation, the baud rate is set at the 1/16 of desired baud rate in the i/o interface. when th e serial operation mode is determined as i/o interface mode, sclk input mode is set. the controller must ensure that its ac timing restrictions are satisfied at th e selected baud rate. in the cas e of i/o interface mode, the boot program does not check the receive error flag; thus there is no error acknowledge responce (bit 3, 0x08).
page 19-25 TMPM372FWUG 2013/4/15 2. the 2nd byte, transmitted from the target board to the controller, is an acknowledge response to the 1st byte where the serial operation mode is set. when 1st byte is determined as uart and can be set at the specified baud rate, data "0x86" is transmitted. when 1st byte is determined as i/ o interface, data "0x30" is transmitted. ? uart mode the 2nd byte is used for distinguishing whether the baud rate can be set. if the baud rate can be set, a value of sc0brcr is renewed and data "0x86" is sent to the controller. if the baud rate cannot be set, transmit operation is stopped and no data is transmitted. after trans- mission of 1st byte completed, the controller a llows for five seconds of time-out. if it does not receive 0x86 within the allowed time-out period, the controller should give up the com- munication. receiving operati on is permitted by setting sc0mod0=1, before load- ing 0x86 to the sio transmit buffer. ? i/o interface mode the boot program sets a value of the sc0mod0 and sc0cr registers to configure the the i/o interface mode and writes 0x30 to the sc0buf. then, the sio0 waits for the sclk0 sig- nal to come from the controller. after the transmission of the 1st byte completed, the control- ler should send the sclk clock to the target board after a certain idle time (several microseconds). this must be done at 1/16 of the desired baud rate. if the 2nd byte, which is from the target board to the controller, is 0 x30, then the controller re gards it as communica- tion possible. from the 3rd byte, users can transmit data at specified baud rate. receiving operation is permitted by setting sc0mod0=1, before loading 0x86 to the sio. 3. the 3rd byte transmitted from the controller to the target bo ard is a command. the code for the ram transfer command is 0x10. 4. the 4th byte, transmitted from the target board to the controller, is an acknowledge response to the 3rd byte. before sending back the acknowl edge response, the boot program checks for a receive error. if there is a receive error, the boot program transmits 0xx8 (bit 3) and returns to the state in which it waits for a command (the third byte) again. in this cas e, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. when the sio0 is configured for i/o interface mode, the boot program does not check for a receive error. if the 3rd byte is equal to any of the command codes listed in table 19-4, the boot program echoes it back to the controller. when the ra m transfer command is r eceived, the boot pro- gram echoes back a value of 0x10 and then br anches to the ram transfer routine. once this branch is taken, password verification is done. password verification is detailed in the later section "password". if the 3rd byte is not a valid command, the boot program sends back 0xx1 (bit 0) to the controller and returns to the state in which it waits for a command (the third byte) again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued command. 5. the 5th to 16th bytes transmitted from the contro ller to the target board, are a 12-byte password. each byte is compared to the contents of following addre sses in the flash memory. the verifica- tion is started with the 5th byte. if the password verification fails, the ram transfer routine sets the password error flag. product name area TMPM372FWUG 0x3f81_fff4 to 0x3f81_ffff
page 19-26 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 6. the 17th byte is a checksum va lue for the password sequence (5th to 16th bytes). to calculate the checksum value for the 12-byte password, add the 12 bytes together, ignore the carries and caluculate the 8-bit two's complement by using lower 8 bits then transmit this checksum value from the controller. the checksum calculation is desc ribed in details in the later section "check- sum calculation". 7. the 18th byte, transmitted from the target board to the controller, is an acknowledge response to the 5th to 17th bytes. first, the ram transfer routine checks for a receive error in the 5th to 17th byte. if there is a receive error, the boot program send s back 0x18 (bit 3) and returns to the state in which it waits for a command (i.e., the 3rd byte) again. in this case, the upper four bits of the acknowledge response are the same as those of the previously issued command (i.e., 1). when the sio0 is configured for i/o interface mode, the ram transfer routine does not check for a receive error. next, the ram transfer routine performs the checksum oper ation to ensure 17th byte data integrity. adding the series of the 5th to 16th bytes must result in 0x00 (with the carry dropped). in case of a checksum error, the ram transfer routine sends back 0x11 to the con- troller and returns to the state in which it wa its for a command (i.e., the 3rd byte) again. finally, the password verification result is checked. if the following case is generated, the boot program transmits an acknowledge response (bit 0, 0x11) as a password error and waits for next operation command (3rd byte). ? irrespective of the result of the password comp arison, all the 12 bytes of a password in the flash memory are the same value other than 0xff. ? not the entire password bytes tr ansmitted from the controller matched those contained in the flash memory. when all the above verification has been succes sful, the ram transfer routine returns a nor- mal acknowledge response (0x10) to the controller. 8. the 19th to 22nd bytes, transmitted from the cont roller the target board, indicate the start address of the ram region where subsequent data (e.g., a flash programming routine) should be stored. the 19th byte corresponds to bits 31 to 24 of the address and the 22nd byte corresponds to bits 7 to 0 of the address. the start address of the stored ram must be even address. 9. the 23rd and 24th bytes, transmitted from the cont roller to the target board, indicate the number of bytes that will be transferred from the controll er to be stored in the ram. the 23rd byte cor- responds to bits 15 to 8 of the number of bytes to be transferred, and the 24 th byte corresponds to bits 7 to 0 of the number of bytes. 10. the 25th byte is a checksum value for the 19th to 24th bytes. to calculate the checksum value, add all these bytes together, ig nore the carries and caluculate the 8-bit two's complement by using lower 8 bits then transmit this checksum value from the controlle r. the checksum calcula- tion is described in detail in the late r section "19.2.10.6 checksum calculation".
page 19-27 TMPM372FWUG 2013/4/15 11. the 26th byte, transmitted from the target board to the controller, is an acknowledge response to the 19th to 25th bytes of data. fi rst, the ram transfer routine ch ecks for a receive error in the 19th to 25th bytes. if there is a receive error, the ram transfer routine sends back 0x18 and returns to the command wait state (i.e., the 3rd byte ) again. in this case, the upper four bits of the acknowledge response are the same as those of the previously issued command (i.e., 1). when the sio0 is configured for i/o interface mode, the ram transfer routine does not check for a receive error. next, the ram transfer routine performs the checksum operation to en sure data integrity. adding the series of the 19th to 24th bytes must result in 0x00 (with the carry dropped). in case of a checksum error, the ram tran sfer routine sends back 0x11 to the controller and returns to the state in which it waits for a command (i.e., the 3rd byte) again. ? the 19th to 25th bytes data must be within the range of 0x2000_0400 to the end address of ram. when the above checks have been successful, the ram transfer rout ine returns a normal acknowledge response (0x10) to the controller. 12. the 27th to mth bytes from the controller are stored in the on-chip ram of the TMPM372FWUG. storage begins at the address specified by the 19th to 22nd bytes and contin- ues for the number of bytes specified by the 23rd to 24th bytes. 13. the (m+1) th byte is a checksum value. to cal culate the checksum value, add the 27th to mth bytes together, ignore the carries and calculate the 8-bit two?s complement by using lower 8 bits then transmit this checksum value from the cont roller. the checksum calculation is described in detail in later section "19. 2.10.6 checksum calculation". 14. the (m+2) th byte is a acknowledge response to the 27th to (m+1) th bytes. first, the ram transfer routine checks for a receive error in th e 27th to (m+1) th bytes. if there is a receive error, the ram transfer routine sends back 0x18 (b it 3) and returns to the state in which it waits for a command (i.e., the 3rd byte) again. in this case, the upper four bits of the acknowledge response are the same as those of the previously issued command (i.e., 1). when the sio0 is con- figured for i/o interface mode, the ram transfer routine does not check for a receive error. next, the ram transfer routine performs the checksum operation to en sure data integrity. adding the series of the 27th to (m+1) th bytes must result in 0x00 (with the carry dropped). in case of a checksum error, the ram transfer routin e sends back 0x11 (bit 0) to the controller and returns to the command wait state (i.e., th e 3rd byte) again. when the above checks have been completed successfully, the ram transf er routine returns a normal acknowledge response (0x10) to the controller. 15. if the (m+2) th byte was a normal acknowledge re sponse, a branch is made to the address speci- fied by the 19th to 22nd bytes. 19.2.10.2chip and protection bit erase command see table 19-7 for the transfer format of this command. 1. the processing of the 1st and 2nd bytes ar e the same as for the ram transfer command. 2. from the controller to the TMPM372FWUG
page 19-28 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 the 3rd byte, which the target board receives from the controller , is a command. the code for the chip and protection bi t erase command is 0x40. 3. from TMPM372FWUG to the controller the 4th byte, transmitted from the target board to the controller, is an acknowledge response to the 3rd byte. before sending back the acknowledge response, the boot pr ogram checks for a receive error. if there was a receive error, th e boot program transmits 0xx8 (b it 3) and returns to the com- mand wait state again. in this case, the upper four bits of the acknowledge response are unde- fined - they hold the same values as the upper four bits of the previously issued command. if the 3rd byte is equal to any of the command codes listed in table 19-4, the boot program echoes it back to the controller. when the chip and protection bit eras e command was received, the boot program echoes back a value of 0x40. if the 3rd byte is not a valid command, the boot program sends back 0xx1 (bit 0) to the controller and returns to the state in which it waits for a command (the third byte) again. in this case, the upper four bits of the acknowledge response are undefined - they hold the same values as the upper four bits of the previously issued com- mand. 4. from the controller to the TMPM372FWUG the 5th byte, transmitted from the target board to the controller, is the chip erase enable command code (0x54). 5. from TMPM372FWUG to the controller the 6th byte, transmitted from the target board to the controller, is an acknowledge response to the 5th byte. before sending back the acknowledge response, the boot pr ogram checks for a receive error. if there was a receive error, th e boot program transmits 0xx8 (b it 3) and returns to the com- mand wait state again. in this case, the upper four bits of the acknowledge response are unde- fined - they hold the same values as the upper four bits of the previously issued command. if the 5th byte is equal to any of the command codes to enable erasing, the boot program ech- oes it back to the controller. when the chip and protection erase command was received, the boot program echoes back a value of 0x54 and then branches to the chip erase routine. if the 5th byte is not a valid command, the boot program sends back 0xx1 (bit 0) to the controller and returns to the state in which it waits for a comma nd (the third byte) again. in this case, the upper four bits of the acknowledge response are unde fined - they hold the same values as the upper four bits of the previously issued command. 6. from TMPM372FWUG to the controller the 7th byte indicates whether the chip er ase command is normally completed or not. at normal completion, completion code (0x4f) is sent. when an error was detected, error code (0x4c) is sent. 7. the 9th byte is the next command code.
page 19-29 TMPM372FWUG 2013/4/15 19.2.10.3acknowledge responses the boot program represents processing states with specific codes. table 19-8 to show the values of possible acknowledge responses to the received data. the upper four bits of the acknowledge response are equal to those of the comm and being executed. the 3rd bit indicates a receive error. the 0th bit indicates an invalid command error, a checksum error or a password error. th e 1st bit and 2nd bit are always "0". receive error checking is not done in i/o interface mode. note: in the uart mode, if the baud rate setting cannot be set, the communication is stopped without any response. note: the upper four bits of the ack response are the same as those of the previous command code. note: the upper four bits of the ack response are the same as those of the operation command code. for example, it is 1 (n ; ram transfer command data [7:4] ) when password error occurs. table 19-8 ack response to the serial operation mode byte return value meaning 0x86 the sio can be configured to operate in uart mode. (see note) 0x30 the sio can be configured to operate in i/o interface mode. table 19-9 ack response to the command byte return value meaning 0x?8 (see note) a receive error occurred while receiving a command code. 0x?1 (see note) an undefined command code was received. (reception was completed normally.) 0x10 the ram transfer command was received. 0x40 the chip erase command was received. table 19-10 ack response to the checksum byte return value meaning 0xn8 (see note) a receive error occurred. 0xn1 (see note) a checksum or password error occurred. 0xn0 (see note) the checksum was correct. table 19-11 ack response to chip and protection bit erase byte return value meaning 0x54 the chip erase enabling command was received. 0x4f the chip erase command was completed. 0x4c the chip erase command was abnormally completed.
page 19-30 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2.10.4determination of a serial operation mode the first byte from the controller determines the serial operation mode. to use uart mode for commu- nications between the controller and the target board, the controller must firstly send a value of 0x86 at a desired baud rate to the target board. to use i/o interface mode, the controller must send a value of 0x30 at 1/16 of the desired baud rate. figure 19-4 show s the waveforms for the first byte in each mode. note: between each point of a/b/c/d of figure 19-4 is expressed as tab, tac, tad, and tcd. figure 19-4 serial operation mode byte after reset is released, the boot program monitors the first serial byte from the controller, with the sio reception disabled, and calculate s the intervals of tab, tac and tad. figure 19-5 shows a flowchart describing the steps to determine the intervals of tab, tac and tad. as shown in the flowchart, the boot program captures timer counts when each time the logic transition occurs in the first serial byte. conse- quently, the calculated tab, tac and tad intervals tend to have slight errors. if the transfer goes at a high baud rate, the cpu might not be able to keep up with the speed of logic transi tions at the serial receive pin. in particular, i/o interface mode may have this problem since its baud rate is generally much higher than that for uart mode. to avoid such a situation, the controller shoul d send the first serial byte at 1/16 of the desired baud rate. the flowchart in figure 19-5 shows how the boot program distinguishes between uart and i/o inter- face modes. if the length of tab is equal to or less than the length of tcd, th e serial operation mode is determined as uart mode. if the length of tab is greater than the length of tcd, the serial operation mode is determined as i/o interface m ode. note that if the baud rate is too high or the ti mer operating fre- quency is too low, each timer value becomes small. it causes an unintent ional behavior of the controller. to prevent this problem, reset uart mode within the programming routine. for example, the serial operation mode may be dete rmined to be i/o interface mode when the intended mode is uart mode. to avoid such a situation, when uart mode is utilized, the controller should allow for a time-out period within which it expects to receive an echo-back (0 x86) from the target board. the controller should give up the communication if it fails to get that echo-back within the allowed time. when i/o interface mode is utilized, once the first serial byte has been transmitted, the controller should send the sclk clock after a certain idle time to get an acknowl edge response. if the received acknowl- edge response is not 0x30, the controller should give up further communications. when the intended mode is i/o inte rface mode, the first byte does not ha ve to be 0x30 as long as tab is greater than tcd as shown above. 0x91, 0xa1 or 0xb1 can be sent as the first byte code to determine the falling edges of point a and point c and the rising ed ges of point b and point d. if tab is greater than tcd and sio is selected by the resolution of the operation mode determination, the second byte code is 0x30 even though the transmitted code on the first byte is not 0x30 (the first byte code to determine i/o interface mode is described as 0x30). uart (0x86) tab point a start bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 stop point b point c point d tcd i/o interface (0x30) tab point a bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 point b point c point d tcd
page 19-31 TMPM372FWUG 2013/4/15 figure 19-5 serial o peration mode byte reception flowchart start initialize tmrb0 prescaler is on.(source clock: t0) high-to-low transition on serial receive pin ? tmrb0 starts counting up low-to-high transition on serial receive pin ? software-capture and save timer value (tab) yes yes high-to-low transition on serial receive pin ? software-capture and save timer value (tac) yes low-to-high transition on serial receive pin ? software-capture and save timer value (tad) yes 16-bit timer 0 stops countting wac  tad? make backup copy of tad value point a point b point c point d done stop operation (infinite wating for reset) yes
page 19-32 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 figure 19-6 serial operation mode dete rmination flowchart 19.2.10.5password the ram transfer command (0x10) causes the boot program to perform password verification. fol- lowing an echo-back of the command code, the boot program verifies the contents of the 12-byte pass- word area within the flash memo ry. the following table shows th e password area of each product. note: if a password is set to 0xff (erased data area), it is difficult to protect data securely due to an easy-to-guess password. even if single boot mode is not used, it is recommended to set a unique value as a password. if all these address locations contain the same byt es of data other than 0xff, a password area error occurs as shown in figure 19-7. in this case, the boot program returns an error acknowledge (0x11) in response to the checksum byte (the 17th byte), regardless of whether the password sequence sent from the controller is all 0xffs. receiving data (5th to 16th bytes) from the controller is compared to the password stored in the flash memory. all of the 12 bytes must match to pass the password verification. otherwise, a password error occurs, which causes the boot program to reply an error acknowledge in response to the checksum byte (the 17th byte). the password verification is performed even if the security function is enabled. figure 19-7 password area verification flowchart product name area TMPM372FWUG 0x3f81_fff4 to 0x3f81_ffff start tcd  tad  tac wab > tcd? uart mode yes i/o interface mode start are all bytes the same ? yes are all bytes equal to 0xff password area error password area is normal. yes
page 19-33 TMPM372FWUG 2013/4/15 19.2.10.6checksum calculation the checksum byte for a series of bytes of data is calculated by adding the bytes together with ignoring the carries and calculating the 8-bit two?s complement by using lower 8 bits. the controller must perform the same checksum operation in transmitting checksum bytes. example) to calculate the checksum for a series of 0xe5 and 0xf6: add the bytes together 0xe5 + 0xf6 = 0x1db calculate the two?s complement by using lower 8 bits, and that is the checksum byte. then send 0x25 to the controller. 0 - 0xdb = 0x25
page 19-34 19. flash 19.2 operation mode TMPM372FWUG 2013/4/15 19.2.11general boot program flowchart figure 19-8 shows an overall flowchart of the boot program. figure 19-8 overall bo ot program flowchart single boot program starts initialize get sio operation mode  sio operation mode ? set i/o interface mode ack data received data (0x30@i/o interface) +1kpvgthceg (send 0x30) normal response prepare to get a command ack data ack data & 0xf0 receive routine get a command  receive error ?  ram transfer ? ack data received data (0x10) transmission roiutine (send 0x10: normal response) ram transfer processing no normally yes (0x10)  chip erase ? ack data received data (0x40) transmission roiutine (send 0x40: normal response) chip erase processing yes (0x40) ack data ack data 0x08 transmission routine (send x8h: receive error) yes ack data received data (0x01) command error transmission routine (send 0xx1: command error) processed normally? jump to ram yes normally  baud rate setting ? program uart mode and baud rate ack data received data (0x86@uart) %cpdgugv (send 0x86) normal response stop operation uart can not be set
page 19-35 TMPM372FWUG 2013/4/15 19.3 on-board programming of flash memory (rewrite/erase) in on-board programming, the cpu is to execute softwa re commands for rewriting or erasing the flash memory. the rewrite/erase control prog ram should be prepared by the user beforehand. because the fl ash memory content cannot be read while it is be ing written or erased, it is necessary to run the rewrite/erase program from the internal ram after shifting to the user boot mode. 19.3.1 flash memory except for some functions, writi ng and erasing flash memory data are in accordance with the standard jedec commands. in writing or erasing, use 32-bit data transfer comma nd of the cpu to enter commands to the flash memory. once the command is entered, the act ual write or erase operation is automatically performed internally. 19.3.1.1 block configuration (1) TMPM372FWUG figure 19-9 block c onfiguration of flash memory (TMPM372FWUG) table 19-12 flash memory functions major functions description automatic page program writes data automatically per page. automatic chip erase erase the entire area of the flash memory automatically. automatic block erase erases a selected block automatically. protect function the write or erase operation can be individually inhibited for each block. 64k bytes (block0) 32k bytes (block1) 16k bytes (block3) 16k bytes (block2) 0x3f81_ffff 0x3f81_0000 0x3f80_8000 0x3f80_4000 0x3f80_0000 single boot mode 0x0001_ffff 0x0001_0000 0x0000_8000 0x0000_4000 0x0000_0000 user boot mode page configuration 64 words ?256 64 words ?128 64 words ?64 64 words ?64
page 19-36 19. flash 19.3 on-board programming of flash memory (rewrite/ erase) TMPM372FWUG 2013/4/15 19.3.1.2 basic operation this flash memory device has the following two operation modes: ? the mode to read memory data (read mode) ? the mode to automatically erase or rewrite memory data (automatic operation) transition to the automatic mode is made by executing a command sequence while it is in the memory read mode. in the automatic operat ion mode, flash memory data cannot be read and any commands stored in the flash memory cannot be executed. in the automatic operation mode, any interrupt or exception gen- eration cannot set the device to the read mode except when a hardware reset is generated. during auto- matic operation, be sure not to cause any exception other than reset and debug exceptions while a debug port is connected. any exception gene ration cannot set the device to th e read mode except when a hard- ware reset is generated. (1) read when data is to be read, the flash memory must be set to the read mode. the flash memory will be set to the read mode immediately after power is applied, when cpu reset is removed, or when an automatic operation is normally te rminated. in order to return to the read mode from other modes or after an automatic operation has b een abnormally terminated, either the read/reset command (a soft- ware command to be described later) or a hardware reset is used. the device must also be in the read mode when any command written on th e flash memory is to be executed. ? read / reset command and read command (software reset) when id-read command is used, the reading op eration is terminated instead of automati- cally returning to the read mode. in this case , the read/reset command can be used to return the flash memory to the read mode. also, wh en a command that has not been completely written has to be canceled, th e read/reset command must be used. the read command is used to return to the read mode after executin g 32-bit data transfer command to write the data "0x0000_00f0" to an arbitrary address of the flash memory. ? with the read/reset command, the device is returned to the read mode after completing the third bus write cycle.
page 19-37 TMPM372FWUG 2013/4/15 (2) command write this flash memory uses the command contro l method. commands are executed by executing a command sequence to the flash memory. the flas h memory executes auto matic operation commands according to the address and data combinati ons applied (refer to command sequence). if it is desired to cancel a command write operatio n already in progress or when any incorrect com- mand sequence has been entered, the read/reset co mmand is to be executed. then, the flash memory will terminate the command execu tion and return to the read. while commands are generally comprised of several bus cycles and the operation applying to the 32-bit (word) data transmission command to the flash memory is called "b us write cycle". the bus write cycles have a specific sequ ential order and the flash memory will perform an automatic opera- tion when the sequence of the bus write cycle da ta and address of command write is operated in accordance with a predefined specific order. if any bus write cy cle does not follow a predefined com- mand write sequence, the flash me mory will terminate the command execution and return to the read mode. note 1: command sequences are executed from outside the flash memory area. note 2: each bus write cycle must be sequentially executed by 32-bit data transmit command. while a command sequence is being executed, access to the flash memory is prohibited. also, do not generate any interrupt (except debug exceptions when a debug port is con- nected). if such an operation is made, it may result in an unexpected read access to the flash memory, and the command sequencer may not be able to correctly recognize the command. while it may cause an abnormal te rmination of the command sequence, it also may cause an incorrect recognition of the command. note 3: for the command sequencer to recognize a command, the device must be in the read mode prior to executing the command. be sure to check before the first bus write cycle where fcflcs is set to "1". it is recommended to subsequently execute a read command. note 4: upon issuing a command, if any address or data is incorrectly written, be sure to perform a software reset to return to the read mode again. 19.3.1.3 reset (hardware reset) a hardware reset is used to cancel the operational mode set by the command wr ite operation when forc- ibly terminated during auto programming/erasing or abnormal termination in the automatic operation. the flash memory has a reset input as the memory bl ock and it is connected to the cpu reset signal. therefore, when the reset input pin of this device is set to vil or when the cpu is reset due to any over- flow of the watch dog timer, the flash memory will return to the read mode terminating any automatic operation that may be in progress. it should also be noted that applying a hardware reset during an auto- matic operation can result in incorrect rewriting of data . in such a case, be sure to perform the rewriting again. refer to section "19.2.1 reset operation" for cpu reset operations. after a given reset input, the cpu will read the reset vector data fr om the flash memory and starts op eration after the reset is removed.
page 19-38 19. flash 19.3 on-board programming of flash memory (rewrite/ erase) TMPM372FWUG 2013/4/15 19.3.1.4 commands (1) automatic page program writing to a flash memory device is to change "1" data cells to "0" data cells. any "0" data cell cannot be changed to a "1" data cell. for changing "0 " data cells to "1" data cells, it is necessary to perform an erase operation. the automatic page programming function of this device writes data of each page. the TMPM372FWUG contains 128 words in a page. a 128 word block is defined by the same [31:9] address. it starts from the address [8:0] = 0x00 and ends at the address [8:0] = 0x1ff. this program- ming unit is hereafter re ferred to as a "page". writing to data cells is automatically performed by an internal sequencer and no external control by the cpu is required. the state of automatic page programming (whether it is in writing operation or not) can be checked by fcflcs [0] . also, any new command sequence is not accepted wh ile it is in the automatic page programming mode. if it is desired to interrupt the automatic pa ge programming, use the hardware reset function. if the operation is stopped by a hardware reset operation, it is necessary to once erase the page and then perform the automatic page programming again b ecause writing to the page has not been normally terminated. the automatic page programming operation is allowed only once for a page already erased. no programming can be performed twice or more. note that rewriting to a page that has been once writ- ten requires execution of the automatic block erase or automatic chip eras e command before execut- ing the automatic page programming command again. note that an attempt to rewrite a page two or more times without erasing the content may cause damages to the device. no automatic verify operation is performed internally to the device. so, be sure to read the data programmed to confirm that it has been correctly written. the automatic page programming operation starts wh en the third bus write cycle of the command cycle is completed. after the fifth bus write cycle, data will be writt en sequentially starting from the next address of the addre ss specified in the fourth bus write cycle (in the fourth bus write cycle, the page top address will be command written) (32 bits of data is input at one time). be sure to use the 32-bit data transfer command in writing commands af ter the fourth bus cycle. at this time, any 32-bit data transfer commands shall no t be placed across word boundary. after the fifth bus write cycle, data is command written to the same page area. even if it is desired to write the page only partially, it is required to perform the automatic page programmi ng for the entire page. in this case, the address input for the fourth bus write cycl e shall be set to the top address of the page. be sure to perform command write operation with the input data set to "1" for the data cells not to be set to "0". for example, if the top address of a pa ge is not to be written, set the input data in the fourth bus write cycle to 0xffffffff as a command write. once the third bus cycle is execut ed, the automatic page programming is in operation. this condi- tion can be checked by monitoring fcflcs. any new command sequence is not accepted while it is in automatic page programming mo de. if it is desired to stop operation, use the hardware reset function. be careful in doing so becau se data cannot be written normally if the opera- tion is interrupted. when a single page has b een command written with normally terminating the automatic page writing process, fcflcs is set to "1" then it returns to the read mode. when multiple pages are to be written, it is necessary to execute the page programming command for each page because the number of pages to be written by a single execution of the automatic page program command is limited to only one page. it is not allowed for automatic page programming to process input data across pages.
page 19-39 TMPM372FWUG 2013/4/15 data cannot be written to a protected block. wh en automatic programming is finished, it automati- cally returns to the read mode. this condition can be checked by monitoring fcflcs. if automatic programming has failed, the flash memory is locked in the current mode and will not return to the read mode. for return ing to the read mode, it is necessary to execute hardware reset to reset the flash memory or the device. in this case, while writing to the address has failed, it is recom- mended not to use the device or not to use the block that includes the failed address. note: software reset becomes ineffective after the fourth bus write cycle of the automatic page programming command. (2) automatic chip erase the automatic chip erase operati on starts when the sixth bus write cycle of the command cycle is completed. this condition can be checked by monitoring fcflcs. while no automatic verify operation is performed internally to the device, be su re to read the data to confirm that data has been correctly erased. any new command sequence is not accepted while it is in an automatic chip erase operation. if it is desired to stop operation, use the hardware reset function. if the operation is forced to stop, it is necessary to perform the automatic chip erase ope ration again because the data erasing operation has not been normally terminated. also, any protected block cannot be erased. if all the blocks are protected, the automatic chip erase operation will not be performed and it returns to the read mode after completing the sixth bus read cycle of the command sequence. wh en an automatic chip erase oper ation is normally terminated, it automatically returns to the read mode. if an au tomatic chip erase operat ion has failed, the flash memory is locked in the current mode and will not return to the read mode. for returning to the read mode, it is necessary to execute hardware reset to reset the device. in this case, the failed block cannot be detected. it is reco mmended not to use the device anymore or to iden- tify the failed block by using the block erase function for not to use the identified block anymore. (3) automatic block erase (for each block) the automatic block erase operation starts when the sixth bus writ e cycle of the command cycle is completed. this status of the automatic bl ock erase operation can be checked by monitoring fcflcs . while no automatic verify operation is performe d internally to the device, be sure to read the data to confirm that data ha s been correctly eras ed. any new command sequence is not accepted while it is in an automatic block erase operation. if it is desired to stop operation, use the hardware reset function. in this case, it is necessary to perform the automatic bl ock erase operation again because the data erasi ng operation has not been normally terminated. also, any protected block cannot be erased. if an automatic block erase operation has failed, the flash memory is locked in the mode and will not re turn to the read mode. in this case, execute hard- ware reset to reset the device. (4) automatic programming of prot ection bits (for each block) this device is implemented with protection bits. this protection can be set for each block. see table 19-16 for table of protection bit addresses. this device assigns 1 bit to 1 block as a protection bit. the applicable protection bit is specified by pba in the seventh bus write cycle. by automati- cally programming the protection bits, write and/or erase functions can be inhibited (for protection) individually for each block. the protection status of each block can be checked by fcflcs to be described later. this status of the automatic programming op eration to set protection bits can be checked by mon itoring fcflcs . an y new command sequence is not
page 19-40 19. flash 19.3 on-board programming of flash memory (rewrite/ erase) TMPM372FWUG 2013/4/15 accepted while automatic programming is in progress to program the protection bits. if it is desired to stop the programming operation, us e the hardware reset function. in this case, it is necessary to per- form the programming operation again because the protection bits ma y not have been correctly pro- grammed. if all the protection bits have been programmed, all fcflcs are set to "1" indicating that it is in the protected state. this disables subsequent writing and erasing of all blocks. note: software reset is ineffective in the seventh bus write cycle of the automatic protection bit programming command. fcflcs turns to "0" after entering the seventh bus write cycle. (5) automatic erasing of protection bits different results will be obtained when the auto matic protection bit er ase command is executed depending on the status of the protection bits and the security bits. it depends on whether all in the fcflcs register are set to "1" or not, when fcsecbit is set to "1". be sure to check the value of fcflcs before executing the automa tic protection bit erase command. see chapter "protect/security function" for details. ? when all the fcflcs are set to "1 " (all the protection bits are programmed): when the automatic protection bit erase comm and is command written, the flash memory is automatically initialized within the device. when the seventh bus write cycle is completed, the entire area of the flash memory data cells is erased and then the protection bits are erased. this operation can be checked by monitoring fcflcs . if the automatic opera- tion to erase protection bits is normally te rminated, fcflcs will be set to "0x00000001". since no automatic verify operation is performed internally to the device, be sure to read the data to confirm that it has been correctly eras ed. for returning to the read mode while the automatic operation after the seve nth bus cycle is in progress, it is necessary to use the hard- ware reset to reset the device. if this is done, it is necessary to check the status of protection bits by fcflcs after retuning to th e read mode and perform either the automatic protection bit erase, automatic chip erase, or automatic block erase operation, as required. ? when fcflcs include "0" (not all the protection bits are programmed): if the automatic protection bit is cleared to "0", the protection condition is canceled. with this device, protection bits can be programme d to an individual block and performed bit- erase operation in the four bits unit as shown in table 19-16. the target bits are specified in the seventh bus write cycle.the protection status of each block can be checked by fcflcs to be described later. this status of the programming operation for automatic pro- tection bits can be checked by monitoring fc flcs . when the automatic oper- ation to erase protection bits is normally terminated, the protection bits of fcflcs selected for erasure are set to "0". in any case, any new command sequence is not accepted while it is in an automatic operation to erase protection bits. if it is desi red to stop the operation, use the hardware reset function. when the automatic operation to erase protection bits is nor mally terminated, it returns to the read mode. note: the fcflcs bit is "0" while in automatic operation and it turns to "1" when the automatic operation is terminated. (6) id-read using the id-read command, you can obtain the type and other information on the flash memory contained in the device. the data to be loaded wi ll be different depending on the address [15:14] of the fourth and subsequent bus write cycles (reco mmended input data is 0x00). after the fourth bus write cycle, when an arbitrary flash memory area is read, the id value will be loaded. once the fourth bus write cycle of an id-read command has passed, the device will not automatically return to the read mode. in this condition, the set of the fo urth bus write cycle and id-read commands can be repeatedly executed. for returning to the read mode, use the read/r eset command or hardware reset command.
page 19-41 TMPM372FWUG 2013/4/15 19.3.1.5 flash control / status register note: do not access to the reserved address. (1) fcflcs (flash control register) note 1: this command must be issued in the ready state. issuing the command in the busy state may disable both correct command transmission and fu rther command input. to exit from the condi- tion, execute system reset. system reset requires at least 0.5 s regardless of the system clock frequency. in this condition, it takes approx. 2 ms to enable reading after reset. note 2: the value varies depending on protection applied. base address = 0x41ff_f000 register name address (base+) reserved - 0x0000 reserved - 0x0004 security bit register fcsecbit 0x0010 reserved - 0x0014 flash control register fcflcs 0x0020 reserved - 0x0024 to 0x0fff 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol----blpro3blpro2blpro1blpro0 after reset0000(note 2)(note 2)(note 2)(note 2) 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------rdy_bsy after reset00000001 bit bit symbol type function 31 to 20 ? r read as 0. 19 to 16 blpro3 to blpro0 r protection for block 3 to 0 0: disabled 1: enabled each of the protection bits represents the protection stat us of the corresponding block. when a bit is set to "1", it indicates that the block corresponding to the bit is protected. when the block is protected, data cannot be written to it. 15 to 1 ? r read as 0. 0 rdy/bsy r ready / busy (note 1) 0:auto operating 1:auto operation terminated. ready/busy flag bit the rdy/bsy output is provided as a means to monitor the st atus of automatic operation. this bit is a function bit for the cpu to monitor the function. when the flash memo ry is in automatic operation, it outputs "0" to indi- cate that it is busy. when the automatic operation is terminated, it returns to the ready state and outputs "1" to accept the next command. if the automatic operation has failed, this bit maintains the "0" output. by applying a hardware reset, it returns to "1".
page 19-42 19. flash 19.3 on-board programming of flash memory (rewrite/ erase) TMPM372FWUG 2013/4/15 (2) fcsecbit (security bit register) note: this register is initialized by cold reset. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------secbit after reset00000001 bit bit symbol type function 31-1 ? r read as 0. 0 secbit r/w security bits 0:disabled 1:enabled
page 19-43 TMPM372FWUG 2013/4/15 19.3.1.6 list of command sequences table 19-13 shows the address and the da ta of each command of flash memory. bus cycles are "bus write cycles" except for the seco nd bus cycle of the read command, the fourth bus- cycle of the read/reset command, a nd the fifth bus cycle of the id-r ead command. bus write cycles are executed by 32-bit (word) data transfer commands. (i n the following table, only lower 8 bits data are shown.) see table 19-14 for the detail of the address bit configuration. use a value of "addr." in the table 19-13 for the address [15:8] of the no rmal command in the table 19-14. note: always set "0" to the address bits [1:0] in the entire bus cycle. supplementary explanation ? ra: read address ? rd: read data ? ia: id address ?id: id data ? pa: program page address pd: program data (32 bit data) after fourth bus cycle, enter data in the order of the address for a page. ? ba: block address ? pba: protection bit address table 19-13 flash memory access from the internal cpu command sequence first bus cycle second bus cycle third bus cycle fourth bus cycle fifth bus cycle sixth bus cycle seventh bus cycle addr. addr. addr. addr. addr. addr. addr. data data data data data data data read 0xxx ?????? 0xf0 ?????? read / reset 0x54xx 0xaaxx 0x54xx ra ??? 0xaa 0x55 0xf0 rd ??? id-read 0x54xx 0xaaxx 0x54xx ia 0xxx ?? 0xaa 0x55 0x90 0x00 id ?? automatic page pro- gramming 0x54xx 0xaaxx 0x54xx pa pa pa pa 0xaa 0x55 0xa0 pd0 pd1 pd2 pd3 automatic chip erase 0x54xx 0xaaxx 0x54xx 0 x54xx 0xaaxx 0x54xx ? 0xaa 0x55 0x80 0xaa 0x55 0x10 ? auto block erase 0x54xx 0xaaxx 0x54xx 0x54xx 0xaaxx ba ? 0xaa 0x55 0x80 0xaa 0x55 0x30 ? protection bit program- ming 0x54xx 0xaaxx 0x54xx 0 x54xx 0xaaxx 0x54xx pba 0xaa 0x55 0x9a 0xaa 0x55 0x9a 0x9a protection bit erase 0x54xx 0xaaxx 0x54xx 0 x54xx 0xaaxx 0x54xx pba 0xaa 0x55 0x6a 0xaa 0x55 0x6a 0x6a
page 19-44 19. flash 19.3 on-board programming of flash memory (rewrite/ erase) TMPM372FWUG 2013/4/15 19.3.2 address bit configur ation for bus write cycles table 19-14 is used in conjunction with "table 19-13 flash memory access from the internal cpu"  address setting can be performed acco rding to the normal bus write cycl e address configuration from the first bus cycle. "0" is recommended" in the table 19-14 address bit conf iguration for bus write cycles can be changed as necessary. as block address, specify any addr ess in the block to be erased. 3 efer to 19.3.1.1 for block configuration. note: as for the addresses from the first to the fifth bus cycles, specify the upper addresses of the blocks to be erased. address addr [31:19] addr [18] addr [17] addr [16] addr [15] addr [14] addr [13:11] addr [10] addr [9] addr [8] addr [7:0] normal commands normal bus write cycle address configuration flash area "0" is recommended. command addr[1:0]="0" (fixed) others:0 (recommended) id-read ia: id address (set the fourth bus write cycle address for id-read operation) flash area "0" is recommended. id address addr[ 1:0]="0" (fixed), others:0 (recommended) block erase ba: block address (set the sixth bus write cycle address for block erase operation) block selection (table 19-14) addr[1:0]="0" (fixed), others:0 (recommended) auto page program- ming pa: program page address (set the fourth bus write cycle address for page programming operation) page selection addr[1:0]="0" (fixed) others:0 (recommended) protection bit pro- gramming pba: protection bit address (s et the seventh bus write cycle address for protection bit programming) flash area protection bit selection (table 19-15) fixed to "0". protect bit selection (table 19-15) addr[1:0]="0" (fixed) others:0 (recom- mended) protection bit erase pba: protection bit address (set the seventh bus erase cycle address for protection bit erasure) flash area protection bit selection (table 19-16) fixed to "0". addr[1:0]="0" (fixed) others:0 (recommended) table 19-14 block address table block address (user boot mode) address (single boot mode) size (kbyte) 2 0x0000_0000 to 0x0000_3fff 0x3f80_0000 to 0x3f80_3fff 16 3 0x0000_4000 to 0x0000_7fff 0x3f80_4000 o 0x3f80_7fff 16 1 0x0000_8000 to 0x0000_ffff 0x3f80_8000 to 0x3f80_ffff 32 0 0x0001_0000 to 0x0001_ffff 0x3f81_0000 to 0x3f81_ffff 64
page 19-45 TMPM372FWUG 2013/4/15 note: the protection bit erase command cannot erase by individual block. table 19-15 protection bit programming address table block protection bit the seventh bus write cycle address address [18] address [17] address [16] address [15:11] address [10] address [9] address [9] block0 0 0 fixed to "0". 00 block1 0 0 0 1 block2 0 0 1 0 block3 0 0 1 1 table 19-16 protection bit erase address table block protection bit the seventh bus write cycle address [18:17] address [18] address [17] block0 to 3 0 0 block4 to 5 0 1 table 19-17 the id-read command's fourth bus write cycle id address (ia) and the data to be read by the following 32-bit data transfer command (id) ia[15:14] id[7:0] code 0y00 0x98 manufacturer code 0y01 0x5a device code 0y10 reserved ? 0y11 0x11 macro code
page 19-46 19. flash 19.3 on-board programming of flash memory (rewrite/ erase) TMPM372FWUG 2013/4/15 19.3.2.1 flowchart figure 19-10 automatic programming note: command sequence is executed by 0x54xx or 0x55xx. start automatic page programming command suquence (see the flowchart shown below) the address of the last page ? yes automatic page programming address = address + 0x200 (set by a page) no automatic page programming command sequence (address / command) 0x54xx/0xaa 0xaaxx/0x55 0x54xx/0xa0 programming address (page address)/ programming data (32 bit data)
page 19-47 TMPM372FWUG 2013/4/15 figure 19-11 automatic erase note: command sequence is executed by 0x54xx or 0x55xx. start automatic chip erase command sequence (see the flowchart shown below) automatic chip erase completed a utomatic chip erase command sequence (address / command) 0x54xx/0xaa 0xaaxx/0x55 0x54xx/0x80 0x54xx/0xaa 0xaaxx/0x55 0x54xx/0x10 automatic block / multi-block erase command sequence (address / command) 0x54xx/0xaa 0xaaxx/0x55 0x54xx/0x80 0x54xx/0xaa 0xaaxx/0x55 block address/0x30
page 19-48 19. flash 19.3 on-board programming of flash memory (rewrite/ erase) TMPM372FWUG 2013/4/15
page 20-1 TMPM372FWUG 2013/4/15 20. rom protection 20.1 outline the TMPM372FWUG offers two kinds of rom protection/ security functions. one is a write/ erase-prot ection function for the internal flash rom data. the other is a security function that restrict s internal flash rom data readout and debugging. 20.2 future 20.2.1 write/ erase- protection function the write/ erase-protection function enables the internal flash to prohibit the writing and erasing operation for each block. to activate the function, write "1" to the corresponding bits to a block to protect. writing "0" to the bits can- cels the protection. the protection settings of the bits can be monitore d by the fcflcs bit. see the chapter "flash" for programming details. 20.2.2 security function the security function restricts flash rom data readout and debugging. this function is available under the conditions shown below. 1. the fcsecbit bit is set to"1". 2. all the protection bits (the fcflcs bits) used for the write/erase-protection function are set to "1". note: the fcsecbit bit is set to "1" at a power-on reset right after power-on. table 20-1 shows details of the restrictions by the security function. table 20-1 restrictions by the security function item details 1) rom data readout data can be read from cpu. 2) debug port communication of jtag/sw and trace are prohibited 3) command for flash memory writing a command to the flash memory is prohibited. an attempt to erase the contents in the bits used for the write/ erase-protection erases all the protection bits.
page 20-2 20. rom protection 20.3 register TMPM372FWUG 2013/4/15 20.3 register note: access to the "reserved" area is prohibited. base address = 0x41ff_f000 register name address(base+) reserved - 0x0000,0x0004 security bit register fcsecbit 0x0010 reserved - 0x0014 flash control register fcflcs 0x0020 reserved - 0x0024 to 0x0fff
page 20-3 TMPM372FWUG 2013/4/15 20.3.1 fcflcs (flash control register) note 1: this command must be issued in the ready state. issuing the command in the busy state may disable both correct command transmission and further command inpu t. to exit from the condition, execute system reset. system reset requires at least 0.5 ms regardless of the system clock frequency. in this condition, it takes approx. 2 ms to enable reading after reset. note 2: the value varies depending on protection applied. 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol----blpro3blpro2blpro1blpro0 after reset0000(note2)(note2)(note2)(note2) 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------rdy_bsy after reset00000001 bit bit symbol type function 31-20 ? r read as 0. 19-16 blpro53 to blpro0 r protection for block3 to 0 0: disabled 1: enabled protection status bits each of the protection bits represents the protection stat us of the corresponding block. when a bit is set to "1," it indicates that the block corresponding to the bit is protected. when the block is protected, data cannot be written to it. 17-1 ? r read as 0. 0 rdy_bsy r ready/busy (note 1) 0: auto operating 1:auto operation terminated ready/busy flag bit the rdy/bsy output is provided as a means to monitor the st atus of automatic operation. this bit is a function bit for the cpu to monitor the function. when the flash memo ry is in automatic operation, it outputs "0" to indi- cate that it is busy. when the automatic operation is terminated, it returns to the ready state and outputs "1" to accept the next command. if the automatic operation has failed, this bit maintains the "0" output. by applying a hardware reset, it returns to "1."
page 20-4 20. rom protection 20.3 register TMPM372FWUG 2013/4/15 20.3.2 fcsecbit(secu rity bit register) note: this register is initialized by cold reset . 31 30 29 28 27 26 25 24 bit symbol-------- after reset00000000 23 22 21 20 19 18 17 16 bit symbol-------- after reset00000000 15 14 13 12 11 10 9 8 bit symbol-------- after reset00000000 7 6 5 4 3 2 1 0 bit symbol-------secbit after reset00000001 bit bit symbol type ?@?\ 31-1 ? r read as 0. 0 secbit r/w security bit 0: disabled 1: enabled
page 20-5 TMPM372FWUG 2013/4/15 20.4 writing and erasing writing and erasing protection bits are available with a single chip mode, single boot mode and writer mode. 20.4.1 protection bits writing to the protection bits is done on block-by-block basis. when the settings for all the blocks are "1", erasing must be done after settin g the fcsecbit bit to "0". setting "1" at that situation erases all the pr otection bits. to write and er ase the protection bits, com- mand sequence is used. see the capter "flash" for details 20.4.2 security bit the fcsecbit bit that activates security fu nction is set to "1" at a power-on reset right after power-on. the bit is rewritten by the following procedure. 1. write the code 0xa74a9d23 to fcsecbit register. 2. write data within 16 clocks from the above.1. note:the above procedure is enabled only w hen using 32-bit data transfer command.
page 20-6 20. rom protection 20.4 writing and erasing TMPM372FWUG 2013/4/15
page 21-1 TMPM372FWUG 2013/4/15 21. debug interface 21.1 specification overview the 5.1.'86( contains the serial wire jtag debug port (swj-dp) unit for interfacing with the debug interface and the embedded trace macrocell ? (etm) unit for trace output. trace data is output to the dedicated pins (tracedata[0] to [1], swv) via the on -chip trace port interface unit (tpiu). 21.2 features of swj-dp swj-dp supports the two-pin serial wire debug port (swdck, swdio) and the jtag debug port (tdi, tdo, tms, tck, trst ). 21.3 features of etm etm supports two data signal pins (tracedata[0] to [1]), one clock signal pin (traceclk) and trace output from swv.
page 21-2 21. debug interface 21.4 pin functions TMPM372FWUG 2013/4/15 21.4 pin functions the debug interface pins can also be used as general-pu rpose ports. the pb3 and pb4 are shared between the jtag debug port function and the serial wire debug port fu nction. the pb5 is shared between the jtag debug port function and the swv tr ace output function. note: in case of enabling swv function after reset, the pb3, pb4, pb5, pb6 and pb76 are config ured as debug port function pins. the functions of other debug interface pins need to be programmed as required. debug interf ace pins can use general purpose port that is not use debug interface. table 21-2 below summarizes the de bug interface pin functio ns and related port settings after reset. when using a low power consumption mode, take note of the following points. note 1: if pb3 and pb5 are configured as debug function pi ns, output continues to be enabled even in stop mode regardless of the setting of the cgstbycr. note 2: if pb4 is configured as a debug function pin, it prevent s a low power consumption mode from being fully effective. configure pb4 to function as a general-pur pose port if the debug function is not used. table 21-1 swj-dp, etm function swj-dp name of jtag debug function sw debug pin name port i/o description i/o description tms/swdio pb3 input jtag test mode selection i/o serial wire data input/output tck/swclk pb4 input jtag test check input serial wire clock tdo/swv pb5 output jtag test data output (input) (note1) (serial wire viewer output) tdi pb6 input jtag test data input - - trst pb7 input jtag test reset - - traceclk pb0 output trace clock output tracedata0 pb1 output trace data output0 tracedata1 pb2 output tracedata output1 table 21-2 debug interface pins and port setting after reset initial port debug port setting after reset (-;no register) setting (bit name) function function (pbfr) input (pbie) output (pbcr) open drain (pbod) pull-up (pbpup) pull- down (pbpdn) port pb0 traceclk 0 0 0 0 0 0 port pb1 tracedata0 0 0 0 0 0 0 port pb2 tracedata1 0 0 0 0 0 0 debug pb3 tms/swdio 1 1 1 0 1 0 debug pb4 tck/swclk 1 1 0 0 0 1 debug pb5 tdo/swv 1 0 1 0 0 0 debug pb6 tdi 1 1 0 0 1 0 debug pb7 trst 110010
page 21-3 TMPM372FWUG 2013/4/15 21.5 connection wi th a debug tool 21.5.1 how to connect for how to connect a debug tool, refer to the me thod recommended by each ma nufacture.debug interface pins have pull-up or pull-down register. when connect with pull-up or pull-down riggers, be sure their settings. 21.5.2 when use general purpose port when debugging, do not change setting debug interf ace to general purpose port by program. then, mcu will be unable to control signals r eceived from the debu gging tools and can not conti nue debugging. according to the usage of the debug interface pins, be sure their setting. 21.6 peripherals oper ation during halt mode when break during debugging, cortex-m3 cpu core going into halt mode. watch dog timer (wdt) is stopped counting automatically. and 16bit timer/counter can specify the status (continue operating or stop) in halt mode. other peripherals are continue operating. table 21-3 debug interface using debug interface ( :enable, -:disable) usage trst tdi tdo/ swv tck/ swclk tms/ swdio trace data1 trace data0 trace clk jtag+sw (after reset) ???? --- jtag+sw (non trst )- ??? --- jtag+trace ??????? sw - - - ? --- sw+swv - - ?? --- disable debug function - - - - - - - -
page 21-4 21. debug interface 21.6 peripherals operation during halt mode TMPM372FWUG 2013/4/15
page 22-1 TMPM372FWUG 2013/4/15 22. electrical characteristics 22.1 absolute maximum ratings note 1: absolute maximum ratings are limiting values of operating and environmental c onditions which should not be exceeded under the worst possible conditions. the equipment manufacturer should design so that no absolute maximum rating value is exceeded with respect to curren t, voltage, power consumption, temperature, etc. expo- sure to conditions beyond those listed above may cause permanent damage to the device or affect device reliabil- ity, which could increase potential risks of personal injury due to ic blowup and/or burning. note 2: vdd = dvdd5 = rvdd5 = avdd5b parameter symbol rating unit supply voltage dvdd5 ? 0.3 to 6 v rvdd5 ? 0.3 to 6 avdd5b ? 0.3 to 6 capacitor voltage vout15 ? 0.3 to 3 v vout3 ? 0.3 to 3.9 input voltage v in ? 0.3 to vdd + 0.3 (note2) v low-level output current per pin i ol 5 ma to t a l i ol 50 high-level output current per pin i oh ? 5 to t a l i oh 50 power consumption pd 600 ( ta = 85 c ) 350 ( ta = 105 c ) mw soldering temperature (10 s) t solder 260 c storage temperature t stg ? 55 to 125 c operating temperature except during flash w/e t opr ? 40 to 85 (1 to 80 mhz) ? 40 to 105 (1 to 32 mhz) c during flash w/e 0 to 70
page 22-2 22. electrical characteristics 22.2 dc electrical characteristics (1/2) TMPM372FWUG 2013/4/15 22.2 dc electrical characteristics (1/2) note 1: ta = 25 c, dvdd5 = avdd5b = rvdd5 = 5v, unless otherwise noted. note 2: the same voltage must be supplied to dvdd5, dvdd5b and rvdd5 . note 3: it is a voltage range in the case of power-on or power-off (when vltd disabled). in the range whose power-line is 3.9v vdd < 4,5v, does not guarantee a 12-bit a/d converter and ac electrical characterist ics. please refer to a figure (powe on sequence (using power on reset only)) for details. note 4: vout15 and vout3 pin should be connected to gnd vi a same value of capacitance. the ic outside can not have the power supply from vout15 and vout3. note 5: vdd = dvdd5 = rvdd5 = avdd5b dvss = avssb = 0v, ta = ? 40 to 105 c parameter symbol rating min. typ. (note 1) max. unit supply voltage (note 2) dvdd5 rvdd5 avdd5b vdd f osc = 8 to 10 mhz fsys = 1 to 80 mhz 4.5 ? 5.5 v supply voltage (during flash w/e) (note 2) dvdd5 rvdd5 avdd5b vdd f osc = 8 to 10 mhz fsys = 1 to 80 mhz ( ta ( c) = 0 to 70 ) 4.5 ? 5.5 v supply voltage (power-on or power-off) (note 3) dvdd5 rvdd5 avdd5b vdd f osc = 8 to 10 mhz fsys = 1 to 80 mhz 3.9 ? 5.5 v low-level input voltage schmitt-input v il1 vdd = 4.5v to 5.5v (note 4) ? 0.3 ? 0.25 vdd v hight-level input voltage schmitt-input v ih1 vdd = 4.5v to 5.5v (note 4) 0.75vdd vdd v capacitance for vout15 and vout3 (note 3) c out rvdd5 = 4.5v to 5.5v vout15, vout3 3.3 ? 4.7 f low-level output voltage v ol i ol = 1.6 ma vdd 4.5v (note 4) ?? 0.4 v high-level output voltage v oh i oh = ? 1.6 ma vdd 4.5v (note 4) 4.1 ?? v input leakage current i li1 0.0 v in vdd (note 4) ? 0.02 5 a output leakage current i lo 0.2 v in vdd -0.2 (note 4) ? 0.05 10 pull-up resister at reset r rst 4.5 vdd 5.5 (note 4) ? 50 150 k ? programmable pull-up/pull-down resistor p kh 4.5 vdd 5.5 (note 4) ? 50 150 k ? schmitt-triggered port v th 4.5 vdd 5.5 (note 4) 0.3 0.6 ? f pin capacitance (except power supply pins) c io fc = 1 mhz ?? 10 pf
page 22-3 TMPM372FWUG 2013/4/15 22.3 dc electrical characteristics (2/2) note 1: ta = 25c, dvdd5 = avdd5b = rvdd5 = 5v, unless otherwise. note 2: i dd normal: all functions operates excluding a/d. note 3: a/d reference voltage supply can not go into off state. note 4: i dd idle : all peripheral functions stopped. dvdd5 = rvdd5 = avdd5b = 4.5 v to 5.5 v, ta = ? 40 to 85 c parameter symbol rating min. typ. (note 1) max. unit normal (note 2) gear 1/1 i dd fsys = 80 mhz ? 43.5 59.5 ma idle (note 4) gear 1/1 ? 15.5 25.5 stop ?? 3.5 7.5 ma dvdd5 = rvdd5 = avdd5b = 4.5 v to 5.5 v, ta = ? 40 to 105 c parameter symbol rating min. typ. (note 1) max. unit normal (note 2) gear 1/1 i dd fsys = 32 mhz ? 23.5 36.5 ma idle (note 4) gear 1/1 ? 8.5 17.5 stop ?? 3.5 7.5 ma
page 22-4 22. electrical characteristics 22.4 12-bit adc electrical characteristics TMPM372FWUG 2013/4/15 22.4 12-bit adc electr ical characteristics note 1: a/d reference voltage supply can not go into off state. note 2: 1lsb = (avdd ? avss)/4096 [v] note 3: avdd = avdd5b, avss = avssb note 4: the characteristic is measured under t he condition in which the only adc is operating. dvdd5 = rvdd5 = avdd5b / vrefhb = 4.5 v to 5.5 v dvss = avssb / vreflb = 0v, ta = ? 40 to 105 c parameter symbol rating min. typ. max unit analog reference voltage ( + ) vrefha vrefhb ?? avdd ? v analog input voltage vain ? avss ? avdd v analog supply current (note 1) iref dvss = avss ? 3.5 4.5 ma supply current a/d conversion ? except iref ?? 6.0 ma inl error ? ain resistance 600 ? ain load capacitance 0.1 f conversion time 2 s ?? 6 lsb dnl error ?? 5 offset error ?? 6 full-scale error ?? 6 total error ??? 10 to + 6
page 22-5 TMPM372FWUG 2013/4/15 22.5 ac electrical characteristics 22.5.1 ac measurement condition ac measurement condition ? output levels: high = 0.8 vdd / low = 0.2 vdd ? input levels: refer to low-level input voltage and hi gh-level input voltage in dc electrical characteris- tics. ? load capacity : cl = 30pf note:vdd = dvdd5 = avdd5b 22.5.2 serial channel timing (sio/uart) 22.5.2.1 i/o interface mode (vdd=4.5v to 5.5v) in the table below, the letter x represents the period of the system clock (fsys). it varies depending on the programming of the clock gear function. (1) sclk input mode (ta = ? 40 to 85 c(1 to 80mhz) / ta = ? 40 to 105 c(1 to 32mhz)) note 1: sclk rise or fall: measured relative to the programmed active edge of sclk. note 2: a calculated value should use it the sclk cycle of the range which is not subtracted. note 3: t oss shows the minimum which is not subtracted. [ input ] parameter symbol equation 80 mhz unit min. max min. max sclk clock high width (input) t sch 34x ? 37.5 ? ns sclk clock low width (input) t scl 3x ? 37.5 ? sclk cycle t scy t sch + t scl ? 75 ? input data valid sclk rise or fall (note1) t srd 30 ? 30 ? inputdata hold or fall after sclk rising (note 1) t hsr x + 30 ? 42.5 ? [ output ] parameter symbol equation 80 mhz unit min. max min. max sclk clock high width (input) t sch 3x ? 37.5 (note 3) ? ns sclk clock low width (input) t scl 3x ? 37.5 (note 3) ? sclk cycle t scy t sch + t scl ? 75 ? outputdata to sclk rise or fall (note 1) t oss t scy /2 ? 3x ? 45 (note2) ? 0 (note 2) ? inputdata hold or fall after sclk rising (note 1) t ohs t scy /2 ? 37.5 ?
page 22-6 22. electrical characteristics 22.5 ac electrical characteristics TMPM372FWUG 2013/4/15 (2) sclk output mode (ta = ? 40 to 85 c(1 to 80mhz) / ta = ? 40 to 105 c(1 to 32mhz)) note 1: a calculated value should use it the sclk cycle of the range which is not subtracted. note 2: t oss shows the minimum which is not subtracted. figure 22-1 serial c hannel timing(sio/uart) [ output ] parameter symbol equation 80 mhz unit min. max min. max sck cycle (programmable) t scy 4x ? 60 ? ns output data sck rise t oss t scy /2 ? 30 (note1) ? 0 (note2) ? sck rise output data hold t ohs t scy /2 ? 30 (note1) ? 0 (note2) ? valid data input sck rise t srd 45 ? 45 ? sck rise input data hold t hsr 0 ? 0 ? 012 3 1 valid output data txd input data rxd sclk (output mode/ rising edge input mode) sclk (falling edge input mode) t oss t scy t sch t scl t ohs 0 t srd 23 t hsr valid valid valid
page 22-7 TMPM372FWUG 2013/4/15 22.5.3 event counter the character x shows the period of the clock for tmrb. the clock of tmrb is the same cycle as a system clock (fsys). it varies depending on the programming of the clock gear function. ta = ? 40 to 85 c (1 to 80mhz) / ta = ? 40 to 105 c (1 to 32mhz) 22.5.4 capture the character x shows the period of the clock for tmrb. the clock of tmrb is the same cycle as a system clock (fsys). it varies depending on the programming of the clock gear function. ta = ? 40 to 85 c (1 to 80mhz) / ta = ? 40 to 105 c (1 to 32mhz) 22.5.5 external interrupt in the table below, the letter x represents the period of the system clock (fsys). ta = ? 40 to 85 c (1 to 80mhz), ? 40 to 105 c (1 to 32mhz) 1. except stop release interrupts 2. stop release interrupts parameter symbol equation 80 mhz unit min. max min. max clock low pulse width t vckl 2x + 100 ? 125 ? ns clock high pulse width t vckh 2x + 100 ? 125 ? ns parameter symbol equation 80 mhz unit min. max min. max low pulse width t cpl 2x + 100 ? 125 ? ns high pulse width t cph 2x + 100 ? 125 ? ns parameter symbol equation 80 mhz unit min. max min. max low pulse width for int0 to f t intal x + 100 ? 112.5 ? ns high pulse width for int0 to f t intah x + 100 ? 112.5 ? ns parameter symbol equation unit min. max min. max low pulse width for int0 to f t intbl 100 ? 100 ? ns high pulse width for int0 to f t intbh 100 ? 100 ? ns
page 22-8 22. electrical characteristics 22.5 ac electrical characteristics TMPM372FWUG 2013/4/15 22.5.6 debug communication 22.5.6.1 ac measurement condition ? output levels : high = 0.7 dvdd5, low = 0.3 dvdd5 ? load capacitance : cl(traceclk) = 25pf, cl(tracedata) = 20pf 22.5.6.2 swd interface 22.5.6.3 jtag interface figure 22-2 jtag and swd communication timing parameter symbol min. max unit clk cycle t dck 100 ? ns data hold after clk rising t d1 4 ? data valid after clk rising t d2 ? 37 data valid to clk rising t ds 20 ? data hold after clk falling t dh 15 ? parameter symbol min. max unit clk cycle t dck 100 ? ns data hold after clk falling t d3 4 ? data valid after clk falling t d4 ? 37 data valid to clk rising t ds 20 ? data hold after clk rising t dh 15 ? t dck t d1 t d2 t d3 t d4 t ds t dh clk input (swclk) (tck) output data (swdio) output data(tdo) input data(swdio) (tms/tdi)
page 22-9 TMPM372FWUG 2013/4/15 22.5.7 trace output ac measurement condition ? output levels : high = 0.7 dvdd5, low = 0.3 dvdd5 ? load capacitance : cl(traceclk) = 25pf, cl(tracedata) = 20pf figure 22-3 trace communication timing 22.5.8 flash characteristics 22.5.9 internal oscillator parameter symbol min. max unit traceclk cycle t tclk 25 ? ns data valid after clk rising t setupr 2 ? data hold after clk rising t holdr 1 ? data valid after clk falling t setupf 2 ? data hold after clk falling t holdf 1 ? parameter rating min. typ. max unit guarantee on flash-memory rewriting ta = 0 to 70 c dvdd5 = rvdd5 = avdd5b = 4.5 to 5.5v ?? 100 times parameter symbol rating min. typ. max unit oscillation frequency fosc2 ta = -40 to 105 c9 . 09 . 51 0m h z 012 3 tracedata 0 to 3 traceclk t setupf t tclk t holdf t setupr t holdr
page 22-10 22. electrical characteristics 22.6 oscillation circuit TMPM372FWUG 2013/4/15 22.6 oscillation circuit figure 22-4 high-frequency oscillation connection note 1: the load value of the oscillator is the sum of lo ads (c1 and c2) and the floating load of the actual assembled board. there is a possibility of operating error when us ing c1 and c2 values in the table below. when designing the board, design the minimum length pattern around the os cillator. we also recommend that oscillator evaluation be carried out using the actual board. note 2: do not be driven x1/x2 by external driver. the tx03 has been evaluated by the oscillator vender belo w. use this information when selecting external parts. 22.6.1 recommended ceramic oscillator the tx03 recommends the high -frequency oscillator by murata manufacturing co., ltd. please refer to the following url for details. http://www.murata.co.jp x1 x2 c1 c2 rd
page 22-11 TMPM372FWUG 2013/4/15 22.7 notes on the power on 22.7.1 using power on reset only note 1: when you start a power supply using built-in power on reset, dvdd5 and rvdd5 terminal should start a power supply to reach the recommendation operati on voltage range (3.9 to 5.5v) within 3 ms. note 2: please choose arbitrary disregard levels after the start of a microcomputer of operation in a voltage detector circuit (vltd), and enable operation. figure 22-5 powe on sequence (using power on reset only) note 1: vdd =dvdd5 = rvdd5 = avdd5b note 2: since power-on-reset release voltage (v porh ) and power-on-reset detection voltage(v porl ) are changed relatively, detection voltage does not reverse them. note 3: if power supply voltage becomes v porl or less, power on reset will start. note 4: a voltage detector circuit (vltd) is initiali zed ( = vltd is disable) by power-on-reset generating. symbol rating min. typ. max unit t pwup warming-up time after reset released - - 3.7 ms t dvdd rising time of power line - - 3 v vltd detection voltage of a voltage detector circuit (in the case of vdcr ="01") 3.9 4.1 4.3 v v porh power-on reset releasing voltage 2.8 3 3.2 v porl power-on reset detection voltage 2.6 2.8 3.0 power-on counter t dvdd t pwup reset state normal mode reset state please make a voltage detector circuit permission during microcomputer operation. 9? note 3 9? 9? note 4 9? microcomputer operation v porh 0v power-on reset signal voltage detector circuit operation (0 9? enable ? 1 9? deseble) supply voltage voltage detection cercuit reset 0.5v vdd v vltd 3.9v v porl
page 22-12 22. electrical characteristics 22.7 notes on the power on TMPM372FWUG 2013/4/15 22.7.2 using external reset 22.7.2.1 in case of the time of external reset shorter then por figure 22-6 power on sequence ( using por and external reset ) (1) note: vdd =dvdd5 = rvdd5 = avdd5b power-on counter t dvdd t pwup depend on t pwup v porh 0v power-on reset signal reset signal supply voltage internal reset signal 0.5v vdd 4.5v
page 22-13 TMPM372FWUG 2013/4/15 22.7.2.2 in case of the time of external reset longer then t pwup figure 22-7 power on sequence ( using por and external reset ) (2) note 1: vdd =dvdd5 = rvdd5 = avdd5b t dvdd t pwup depend on the time of external reset. power-on counter v porh 0v internal reset signal 0.5v vdd 4.5v supply voltage power-on reset signal reset signal
page 22-14 22. electrical characteristics 22.7 notes on the power on TMPM372FWUG 2013/4/15 22.7.2.3 in case of the rising time of power line longer then t pwup figure 22-8 power on sequence ( t dvdd > t pwup ) note 1: vdd =dvdd5 = rvdd5 = avdd5b note 2: in this case, must be reset from reset pin. power-on counter t dvdd t pwup vdd must reach operating voltage and after 200sec, external reset can released. v porh 0v power-on reset signal reset signal supply voltage internal reset signal 0.5v vdd 4.5v
page 23-1 TMPM372FWUG 2013/4/15 23. package dimensions 23.1 type: p-lqfp64-1010-0  50e unit: mm
page 23-2 23. package dimensions 23.1 type: p-lqfp64-1010-0  50e TMPM372FWUG 2013/4/15
page 1 TMPM372FWUG restrictions on product use ? toshiba corporation, and its subsidiaries and affiliates (collectively "toshiba"), reserve the right to make changes to the information in this document, and related hardware, software and systems (collectively "product") without notice.  this document and any information herein may not be reproduced without prior written permission from toshiba. even with toshiba's written permission, reproduction is permissible only if reproduction is without alteration/omission.  though toshiba works continually to improve product's quality and reliability, product can malfunction or fail. customers are responsible for complying with safety standards and for providing adequate designs and safeguards for their hardware, software and systems which minimize risk and avoid situations in which a malfunction or failure of product could cause loss of human life, bodily injury or damage to property, including data loss or corruption. before customers use the product, create designs including the product, or incorporate the product into their own applications, customers must also refer to and comply with (a) the latest versions of all relevant toshiba information, including without limitation, this document, the specifications, the data sheets and application notes for product and the precautions and conditions set forth in the "toshiba semiconductor reliability handbook" and (b) the instructions for the application with which the product will be used with or for. customers are solely responsible for all aspects of their own product design or applications, including but not limited to (a) determining the appropriateness of the use of this product in such design or applications; (b) evaluating and determining the applicability of any information contained in this document, or in charts, diagrams, programs, algorithms, sample application circuits, or any other referenced documents; and (c) validating all operating parameters for such designs and applications. toshiba assumes no liability for customers' product design or applications .  product is neither intended nor warranted for use in equipments or systems that require extraordinarily high levels of quality and/or reliability, and/or a malfunction or failure of which may cause loss of human life, bodily injury, serious property damage and/or serious public impact ("unintended use"). except for specific applications as expressly stated in this document, unintended use includes, without limitation, equipment used in nuclear facilities, equipment used in the aerospace industry, medical equipment, equipment used for automobiles, trains, ships and other transportation, traffic signaling equipment, equipment used to control combustions or explosions, safety devices, elevators and escalators, devices related to electric power, and equipment used in finance-related fields. if you use product for unintended use, toshiba assumes no liability for product. for details, please contact your toshiba sales representative.  do not disassemble, analyze, reverse-engineer, alter, modify, translate or copy product, whether in whole or in part.  product shall not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable laws or regulations.  the information contained herein is presented only as guidance for product use. no responsibility is assumed by toshiba for any infringement of patents or any other intellectual property rights of third parties that may result from the use of product. no license to any intellectual property right is granted by this document, whether express or implied, by estoppel or otherwise.  absent a written signed agreement, except as provided in the relevant terms and conditions of sale for product, and to the maximum extent allowable by law, toshiba (1) assumes no liability whatsoever, including without limitation, indirect, consequential, special, or incidental damages or loss, including without limitation, loss of profits, loss of opportunities, business interruption and loss of data, and (2) disclaims any and all express or implied warranties and conditions related to sale, use of product, or information, including warranties or conditions of merchantability, fitness for a particular purpose, accuracy of information, or noninfringement.  do not use or otherwise make available product or related software or technology for any military purposes, including without limitation, for the design, development, use, stockpiling or manufacturing of nuclear, chemical, or biological weapons or missile technology products (mass destruction weapons). product and related software and technology may be controlled under the applicable export laws and regulations including, without limitation, the japanese foreign exchange and foreign trade law and the u.s. export administration regulations. export and re-export of product or related software or technology are strictly prohibited except in compliance with all applicable export laws and regulations. ? please contact your toshiba sales representative for details as to environmental matters such as the rohs compatibility of product. please use product in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the eu rohs directive. toshiba assumes no liability for damages or losses occurring as a result of noncompliance with applicable laws and regulations.
page 2 TMPM372FWUG


▲Up To Search▲   

 
Price & Availability of TMPM372FWUG

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X